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

@ -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 ) ) {

View File

@ -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.