delete_term_meta

Removes metadata matching criteria from a term.

Description

delete_term_meta( (int) $term_id, (string) $meta_key, (string) $meta_value = '' ); 

Parameters (3)

0. $term_id (int)
The term id.
1. $meta_key (string)
Metadata name.
2. $meta_value — Optional. (string) => ''
Metadata value. If provided, rows will only be removed that match the value.

Usage

  1. if ( !function_exists( 'delete_term_meta' ) ) { 
  2. require_once ABSPATH . WPINC . '/taxonomy.php'; 
  3.  
  4. // The term id. 
  5. $term_id = -1; 
  6.  
  7. // Metadata name. 
  8. $meta_key = ''; 
  9.  
  10. // Optional. Metadata value. If provided, rows will only be removed that match the value. 
  11. $meta_value = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = delete_term_meta($term_id, $meta_key, $meta_value); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/taxonomy.php  
  1. function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) { 
  2. // Bail if term meta table is not installed. 
  3. if ( get_option( 'db_version' ) < 34370 ) { 
  4. return false; 
  5.  
  6. $deleted = delete_metadata( 'term', $term_id, $meta_key, $meta_value ); 
  7.  
  8. // Bust term query cache. 
  9. if ( $deleted ) { 
  10. wp_cache_set( 'last_changed', microtime(), 'terms' ); 
  11.  
  12. return $deleted;