_wp_check_split_nav_menu_terms()
If the term being split is a nav_menu, changes associations.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
null. Nothing (null).
Usage
_wp_check_split_nav_menu_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy );
- $term_id(int) (required)
- ID of the formerly shared term.
- $new_term_id(int) (required)
- ID of the new term created for the
$term_taxonomy_id. - $term_taxonomy_id(int) (required)
- ID for the term_taxonomy row affected by the split.
- $taxonomy(string) (required)
- Taxonomy for the split term.
Changelog
| Since 4.3.0 | Introduced. |
_wp_check_split_nav_menu_terms() wp check split nav menu terms code WP 7.0
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 );
}