_wp_check_split_default_terms

Check default categories when a term gets split to see if any of them need to be updated.

Description

_wp_check_split_default_terms( (int) $term_id, (int) $new_term_id, (int) $term_taxonomy_id, (string) $taxonomy ); 

Parameters (4)

0. $term_id (int)
ID of the formerly shared term.
1. $new_term_id (int)
ID of the new term created for the $term_taxonomy_id.
2. $term_taxonomy_id (int)
ID for the term_taxonomy row affected by the split.
3. $taxonomy (string)
Taxonomy for the split term.

Usage

  1. if ( !function_exists( '_wp_check_split_default_terms' ) ) { 
  2. require_once ABSPATH . WPINC . '/taxonomy.php'; 
  3.  
  4. // ID of the formerly shared term. 
  5. $term_id = -1; 
  6.  
  7. // ID of the new term created for the $term_taxonomy_id. 
  8. $new_term_id = -1; 
  9.  
  10. // ID for the term_taxonomy row affected by the split. 
  11. $term_taxonomy_id = -1; 
  12.  
  13. // Taxonomy for the split term. 
  14. $taxonomy = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = _wp_check_split_default_terms($term_id, $new_term_id, $term_taxonomy_id, $taxonomy); 
  18.  

Defined (1)

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

/wp-includes/taxonomy.php  
  1. function _wp_check_split_default_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { 
  2. if ( 'category' != $taxonomy ) { 
  3. return; 
  4.  
  5. foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) { 
  6. if ( $term_id == get_option( $option, -1 ) ) { 
  7. update_option( $option, $new_term_id );