[wp-trac] [WordPress Trac] #48015: Unexpected results from wp_nav_menu()

WordPress Trac noreply at wordpress.org
Thu Oct 3 08:37:55 UTC 2019


#48015: Unexpected results from wp_nav_menu()
----------------------------+------------------------------
 Reporter:  ChiefAlchemist  |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Menus           |     Version:  5.2.3
 Severity:  major           |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by anuj2):

 In the core file wp-includes/nav-menu-template.php

 {{{
 // get the first menu that has items if we still can't find a menu
         if ( ! $menu && ! $args->theme_location ) {
                 $menus = wp_get_nav_menus();
                 foreach ( $menus as $menu_maybe ) {
                         if ( $menu_items = wp_get_nav_menu_items(
 $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ) ) {
                                 $menu = $menu_maybe;
                                 break;
                         }
                 }
         }
 }}}


 It is stated that if the menu passed in the arguments in not found then
 get the first menu that has items

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48015#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list