A WordPress-centric search engine for devs and theme authors



_wp_check_split_nav_menu_terms ›

Since4.3.0
Deprecatedn/a
_wp_check_split_nav_menu_terms ( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy )
Parameters: (4)
  • (int) $term_id ID of the formerly shared term.
    Required: Yes
  • (int) $new_term_id ID of the new term created for the $term_taxonomy_id.
    Required: Yes
  • (int) $term_taxonomy_id ID for the term_taxonomy row affected by the split.
    Required: Yes
  • (string) $taxonomy Taxonomy for the split term.
    Required: Yes
Defined at:
Codex:

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



Source

function _wp_check_split_nav_menu_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
	if ( 'nav_menu' !== $taxonomy ) {
		return;
	}

	// Update menu locations.
	$locations = get_nav_menu_locations();
	foreach ( $locations as $location => $menu_id ) {
		if ( $term_id == $menu_id ) {
			$locations[ $location ] = $new_term_id;
		}
	}
	set_theme_mod( 'nav_menu_locations', $locations );
}