Make WordPress Core

Changeset 23453


Ignore:
Timestamp:
02/19/2013 01:31:42 AM (12 years ago)
Author:
SergeyBiryukov
Message:

Fix a warning on Menus screen if $menu_locations is false.
Fix menu selection after creating a first menu on new install.

props jkudish.
fixes #23508. see #23119.

File:
1 edited

Legend:

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

    r23441 r23453  
    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();
    267269
    268270        // Remove menu locations that have been unchecked
     
    372374
    373375// Set $nav_menu_selected_id to 0 if no menus
    374 if ( $one_theme_location_no_menus )
     376if ( $one_theme_location_no_menus ) {
    375377    $nav_menu_selected_id = 0;
     378} elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) {
     379    // if we have no selection yet, and we have menus, set to the first one in the list
     380    $nav_menu_selected_id = $nav_menus[0]->term_id;
     381}
    376382
    377383// Update the user's setting
Note: See TracChangeset for help on using the changeset viewer.