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

git-svn-id: https://develop.svn.wordpress.org/trunk@23550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-03-01 15:51:16 +00:00
parent d7c28ced8a
commit c99000e98c
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();
}
/**