[wp-trac] [WordPress Trac] #14438: Allow term_id in Wp_query

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 28 03:19:00 UTC 2010


#14438: Allow term_id in Wp_query
-------------------------+--------------------------------------------------
 Reporter:  DreadLox     |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:                 
 Severity:  major        |    Keywords:                 
-------------------------+--------------------------------------------------
 Hello,

 A parameter 'term_id' is missing in wp_query. Instead of:

 $term = get_term($menu_id, 'nav_menu');

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

 We should be able to do:

 $menu_items = new WP_Query(
        array(
                'post_type'   => 'nav_menu_item',
                'post_status' => 'any',
                'meta_key'    => '_menu_item_object_id',
                'meta_value'  => $post_id,
                'showposts'   => -1,
                'taxonomy'    => 'nav_menu',
                'term_id'        => $menu_id,
        )
 );

 It saves the overload of using an additional query with get_term function.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14438>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list