Make WordPress Core


Ignore:
Timestamp:
06/24/2014 05:24:23 PM (11 years ago)
Author:
wonderboymusic
Message:

When selecting a fallback menu in wp_nav_menu(), the "first" menu is retrieved from an unsorted query. When retrieving a fallback menu, pass array( 'orderby' => 'name' ) to wp_get_nav_menus() to return a menu consistently.

Props lukecarbis.
Fixes #28126.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/nav-menu-template.php

    r28514 r28826  
    278278    // get the first menu that has items if we still can't find a menu
    279279    if ( ! $menu && !$args->theme_location ) {
    280         $menus = wp_get_nav_menus();
     280        $menus = wp_get_nav_menus( array( 'orderby' => 'name' ) );
    281281        foreach ( $menus as $menu_maybe ) {
    282282            if ( $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ) ) {
Note: See TracChangeset for help on using the changeset viewer.