Can someone tell me how the wp_nav_menu
functions when no menu
or theme_location
is specified?
I have multiple sites that use an interior navigation setup that does not specify the menu. It would seem that this results in WordPress searching within all menus until the page is found. For 99% of my sites, this functionality works perfectly.
However, I've noticed if multiple menus contain the same page (and these pages have different children specified to them), wp_nav_menu
seems to return the first menu that it discovers which contains the desired page. In certain instances, this is ends up being from a menu that does not contain all of the pages in main navigational hierarchy.
Therefore, I was wondering if there was a way to specify the menu order (i.e. check the main menu first, then the footer, then utility, etc), or if a master menu should be implemented that is never displayed on the site, but is utilized to provide the proper page hierarchy for the site.
Any thoughts on approaches or best practices would be helpful.
For full disclosure, please note that I have extended my wp_nav_menu by utilizing WP Nav Plus, but I do not think that plugin changes my question
$menus = wp_get_nav_menus( array( 'orderby' => 'name' ) );
does clarify how it works. Am I correct in assuming that if it isn't found in the first non-empty menu, it stops attempting to look in other menus?