Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#13018 closed defect (bug) (invalid)

The fallback_cb option of wp_nav_menu is always called

Reported by: Michael Owned by: ryan
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords:
Focuses: Cc:


I find that using the following:

wp_nav_menu( array(

'sort_column' => 'menu_order',
'menu' => 'Header Menu',
'container_class' => 'headermenu',
'fallback_cb' => wp_page_menu( array( 'menu_class' => 'headermenu', 'show_home' => esc_attr( get_option('k2blogornoblog') ), 'depth' => 3 ) )
) );

The fallback_cb option is called regardless of whether or not it's supposed to. I'm not sure if I'm simply doing something wrong, as the whole feature seems woefully incomplete so far (no children, not use for the 'menu' option as far as I can tell), but I thought it was worth mentioning in case it actually is a bug.

Change History (2)

#1 @duck_
11 years ago

  • Resolution set to invalid
  • Status changed from new to closed

You're using fallback_cb wrong in this case. An example of what you want to do is something like:

wp_nav_menu( array( 
    'menu' => 'Header Menu', 
    'container_class' => 'headermenu', 
    'depth' => 3, 
    'menu_class' => 'headermenu', 
    'show_home' => false 
) );

if no menu is found then the array of arguments is passed onto the fallback callback.

To get children in the menu drag a menu item onto the item you want to its parent (though this may change).

#2 @nacin
11 years ago

  • Milestone Unassigned deleted

Yeah, it has to be a valid callback.

Note: See TracTickets for help on using tickets.