Make WordPress Core

Changeset 23550


Ignore:
Timestamp:
03/01/2013 03:51:16 PM (14 years ago)
Author:
SergeyBiryukov
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/nav-menus.php

    r23529 r23550  
    265265                $locations = get_registered_nav_menus();
    266266                $menu_locations = get_nav_menu_locations();
    267                 if ( empty( $menu_locations ) || ! is_array( $menu_locations ) )
    268                         $menu_locations = array();
    269267
    270268                // Remove menu locations that have been unchecked
  • trunk/wp-includes/nav-menu.php

    r23416 r23550  
    128128
    129129function get_nav_menu_locations() {
    130         return get_theme_mod( 'nav_menu_locations' );
     130        $locations = get_theme_mod( 'nav_menu_locations' );
     131        return ( is_array( $locations ) ) ? $locations : array();
    131132}
    132133
Note: See TracChangeset for help on using the changeset viewer.