[wp-hackers] Select pages's associated menu items in a specific menu

Lox lox.dev at knc.nc
Tue Jul 27 21:38:32 UTC 2010


Hello,

I try to get a pages's associated menu items in a specific menu, and I
came to this (my menu id is 3) :

$term = get_term(3, 'nav_menu');
	
$query = new WP_Query;
$menu_items = $query->query(
    array(
	    'meta_key' => '_menu_item_object_id',
	    'meta_value' => $object_id,
	    'post_status' => 'any',
	    'post_type' => 'nav_menu_item',
	    'showposts' => -1,
    	    'nav_menu' => $term->slug
    )
);

This doesn't work. So I tried:

$menu_items = $query->query(
    array(
	    'meta_key' => '_menu_item_object_id',
	    'meta_value' => $object_id,
	    'post_status' => 'any',
	    'post_type' => 'nav_menu_item',
	    'showposts' => -1,
    	    'term_id' => 3
    )
);


Doesn't work too.... Any thought ?

-- 
Lox
lox.dev at knc.nc


More information about the wp-hackers mailing list