diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index 0706b6c5d1..1833296f28 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -264,8 +264,6 @@ switch ( $action ) { // Get existing menu locations assignments $locations = get_registered_nav_menus(); $menu_locations = get_nav_menu_locations(); - if ( empty( $menu_locations ) || ! is_array( $menu_locations ) ) - $menu_locations = array(); // Remove menu locations that have been unchecked foreach ( $locations as $location => $description ) { diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 53768c27e6..63c0773aa7 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -127,7 +127,8 @@ function get_registered_nav_menus() { */ function get_nav_menu_locations() { - return get_theme_mod( 'nav_menu_locations' ); + $locations = get_theme_mod( 'nav_menu_locations' ); + return ( is_array( $locations ) ) ? $locations : array(); } /**