Ensure that get_nav_menu_locations() always returns an array. props JustinSainton for initial patch. fixes #23508.

git-svn-id: http://core.svn.wordpress.org/trunk@23550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-03-01 15:51:16 +00:00
parent 463c4d7dd1
commit 87f2c02462
2 changed files with 2 additions and 3 deletions

View File

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

View File

@ -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();
}
/**