[wp-hackers] wp_get_nav_menu_items not working?
steve at sltaylor.co.uk
Mon Mar 7 23:27:59 UTC 2011
Going a bit mad with this one. I've used a nav menu in a previous
project so the client can select and order items to feature in a
carousel-type thing on the home page. I used something like this to
get all the post objects associated with the menu items:
$slt_hero_menu = wp_get_nav_menu_items( "hero-carousel" );
$slt_hero_items = array();
foreach ( $slt_hero_menu as $slt_hero_menu_item )
$slt_hero_items = get_post( $slt_hero_menu_item->object_id );
For some reason I can't currently fathom, this doesn't work on another
site I'm working on.
- wp_nav_menu( "hero-carousel" ) printed the menu out fine
- has_nav_menu( "hero-carousel" ) returns true
- is_nav_menu( "hero-carousel" ) returns false
- BUT wp_get_nav_menu_items( "hero-carousel" ) return zilch
AFAIK I've got the menu registered, created and assigned all as
normal. I suspect I'm falling foul of some confusion between whatever
is implied by what has_nav_menu() and is_nav_menu() return.
More information about the wp-hackers