_wp_check_split_nav_menu_terms

If the term being split is a nav_menu, change associations.

Description

_wp_check_split_nav_menu_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_nav_menu_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_nav_menu_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_nav_menu_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { 
  2. if ( 'nav_menu' !== $taxonomy ) { 
  3. return; 
  4.  
  5. // Update menu locations. 
  6. $locations = get_nav_menu_locations(); 
  7. foreach ( $locations as $location => $menu_id ) { 
  8. if ( $term_id == $menu_id ) { 
  9. $locations[ $location ] = $new_term_id; 
  10. set_theme_mod( 'nav_menu_locations', $locations );