_wp_check_split_nav_menu_terms()WP 4.3.0

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

Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

_wp_check_split_nav_menu_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy );
$term_id(int) (обязательный)
ID of the formerly shared term.
$new_term_id(int) (обязательный)
ID of the new term created for the $term_taxonomy_id.
$term_taxonomy_id(int) (обязательный)
ID for the term_taxonomy row affected by the split.
$taxonomy(строка) (обязательный)
Taxonomy for the split term.

Список изменений

С версии 4.3.0 Введена.

Код _wp_check_split_nav_menu_terms() WP 6.5.2

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 );
}