Make WordPress Core

Ticket #23119: 23119.4.diff

File 23119.4.diff, 1.1 KB (added by jkudish, 11 years ago)

fix missing select/dropdown of menus which was causing some menus to be invisible

  • wp-admin/nav-menus.php

     
    264264                // Get existing menu locations assignments
    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
    269271                foreach ( $locations as $location => $description ) {
     
    371373        $nav_menu_selected_id = $nav_menus[0]->term_id;
    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
    378384if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )