主题更改后处理菜单配置。

原型

_wp_menus_changed()

源文件

路径:wp-includes/nav-menu.php

<?php
...
function _wp_menus_changed() {
	$old_nav_menu_locations    = get_option( 'theme_switch_menu_locations', array() );
	$new_nav_menu_locations    = get_nav_menu_locations();
	$mapped_nav_menu_locations = wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations );
	set_theme_mod( 'nav_menu_locations', $mapped_nav_menu_locations );
	delete_option( 'theme_switch_menu_locations' );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/_wp_menus_changed/