From 2ddcc549d2a6b491baf568b92f8e61c353dcce54 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Wed, 25 Oct 2017 22:28:43 +0000 Subject: [PATCH] Menus: Add `menu-$i` slugs to mapping groups Helps to future proof the feature. Also orders slugs by popularity to optimize mapping time. See #39692. git-svn-id: https://develop.svn.wordpress.org/trunk@42026 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/nav-menu.php | 4 ++-- tests/phpunit/tests/menu/nav-menu.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php index 503490b67a..6a290bdaa9 100644 --- a/src/wp-includes/nav-menu.php +++ b/src/wp-includes/nav-menu.php @@ -1124,8 +1124,8 @@ function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locat * from within the same group, make an educated guess and map it. */ $common_slug_groups = array( - array( 'header', 'main', 'navigation', 'primary', 'top' ), - array( 'bottom', 'footer', 'secondary', 'subsidiary' ), + array( 'primary', 'menu-1', 'main', 'header', 'navigation', 'top' ), + array( 'secondary', 'menu-2', 'footer', 'subsidiary', 'bottom' ), array( 'social' ), ); diff --git a/tests/phpunit/tests/menu/nav-menu.php b/tests/phpunit/tests/menu/nav-menu.php index 562c866c23..b0da967b8b 100644 --- a/tests/phpunit/tests/menu/nav-menu.php +++ b/tests/phpunit/tests/menu/nav-menu.php @@ -172,8 +172,8 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase { $new_next_theme_nav_menu_locations = wp_map_nav_menu_locations( $old_next_theme_nav_menu_locations, $prev_theme_nav_menu_locations ); $expected_nav_menu_locations = array( - 'main' => 1, - 'primary' => 2, + 'primary' => 1, + 'main' => 2, ); $this->assertEquals( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations ); }