[wp-trac] [WordPress Trac] #16594: inconsistency in wp_nav_menu_items
WordPress Trac
wp-trac at lists.automattic.com
Sat Feb 19 11:41:11 UTC 2011
#16594: inconsistency in wp_nav_menu_items
--------------------------+------------------------------
Reporter: thomask | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 3.1
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by greuben):
I think it is the expected behavior. For wp_nav_menu we pass
'theme_location' but in the widget we pass 'menu' object.
If you want to get the menu object in wp_nav_menu like in widget, you can
try this
{{{
add_filter('wp_nav_menu_items','my_test', 10, 2);
function my_test($items, $args) {
if( !$args->menu ) {
$locations = get_nav_menu_locations();
print_r( wp_get_nav_menu_object(
$locations[$args->theme_location] ) );
}
else{
print_r ( $args->menu );
}
}
}}}
If it is not the expected behavior then adding {{{$args->menu = $menu;}}}
in wp_nav_menu function in wp-includes/nav-menu-tempalte.php fixes it.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16594#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list