From b17b035009d94a2f8617cfb31c367d6718bc5e2d Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Tue, 10 Oct 2017 17:08:48 +0000 Subject: [PATCH] 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 --- wp-includes/nav-menu.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 38ef5c89bc..aff8a54373 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -1084,7 +1084,8 @@ function _wp_menus_changed() { * @return array Nav menus mapped to new 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. if ( empty( $old_nav_menu_locations ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 8fd15a1129..18fecc2f20 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.