I am testing out the nav menu function in 3.0-beta2-14769 and it is pretty cool. I came across something that might be a bug and I am not too sure how I am suppose to go about it so I am posted it here. (Please let me know if I am in the wrong place.)
I have registered two menus in my theme using the following code:
register_nav_menu('main', 'Main Navigation Menu'); register_nav_menu('sub', 'Sub-Navitation Menu');
When calling the registered menu within the
wp_nav_menu() function, I use the
theme_location argument. It works perfectly if both menu are created and assigned to each registered menu location.
If there are no menus, the
fallback_cb argument allows me to create a function to set a default state, which is great.
The problem occurs if no menu is assigned to a specific registered menu location. If only one menu has been created, both locations display it whether it was assigned to that location or not.
I looked at the
nav-menu-template.php file and it seems that the process for getting the nav menu works like this:
1. Get the nav menu based on the requested menu name 2. If no menu, get the nav menu based on the theme_location 3. Get the first menu that has items if we still can't find a menu 4. If a menu exists, get its items 5. If no menu was found or if the menu has no items, call the fallback_cb
If a menu has been registered and no menu has been assigned to it, it seems like it should default to the
fallback_cb as opposed to
get the first menu that has items.