[wp-hackers] wp_get_nav_menu_items not working?

Steve Taylor steve at sltaylor.co.uk
Tue Mar 8 21:02:46 UTC 2011


Bug in WP core? Or my misunderstanding? Hmmm, guess what...

For anyone else suffering from the same confusion, I was wrongly using
wp_get_nav_menu_items() to try and get the menu items via the menu
*location* slug (as registered with register_nav_menus()). However,
wp_get_nav_menu_items() takes the ID, slug or title of the menu
created in Admin > Menus.

I want to reference things by the slug I used for the registered
location, so I used this code:

$slt_menu_locations = get_nav_menu_locations();
$slt_hero_menu = $slt_menu_locations[ 'hero-carousel' ];
$slt_hero_menu = wp_get_nav_menu_items( $slt_hero_menu );

Steve Taylor


More information about the wp-hackers mailing list