Menus: Limit mapping to registered locations

Weeds out orphaned locations, so their information will not continue to be mapped to future themes.

Fixes #42121.

Built from https://develop.svn.wordpress.org/trunk@41811


git-svn-id: http://core.svn.wordpress.org/trunk@41645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2017-10-10 17:08:48 +00:00
parent a22bb4f3ad
commit b17b035009
2 changed files with 3 additions and 2 deletions

View File

@ -1085,6 +1085,7 @@ function _wp_menus_changed() {
*/ */
function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ) { function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ) {
$registered_nav_menus = get_registered_nav_menus(); $registered_nav_menus = get_registered_nav_menus();
$new_nav_menu_locations = array_intersect_key( $new_nav_menu_locations, $registered_nav_menus );
// Short-circuit if there are no old nav menu location assignments to map. // Short-circuit if there are no old nav menu location assignments to map.
if ( empty( $old_nav_menu_locations ) ) { if ( empty( $old_nav_menu_locations ) ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta1-41810'; $wp_version = '4.9-beta1-41811';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.