[wp-trac] [WordPress Trac] #12891: Advanced multi-taxonomy WP_Query()s

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 19 07:17:26 UTC 2010


#12891: Advanced multi-taxonomy WP_Query()s
----------------------------+-----------------------------------------------
 Reporter:  markjaquith     |       Owner:  markjaquith    
     Type:  task (blessed)  |      Status:  assigned       
 Priority:  normal          |   Milestone:  3.1            
Component:  Query           |     Version:  3.0.1          
 Severity:  normal          |    Keywords:  ongoing-project
----------------------------+-----------------------------------------------

Comment(by ryan):

 {{{
 SELECT SQL_CALC_FOUND_ROWS wp_14578484_posts.* FROM wp_14578484_posts
 INNER JOIN wp_14578484_term_relationships ON (wp_14578484_posts.ID =
 wp_14578484_term_relationships.object_id) WHERE 1=1 AND
 wp_14578484_posts.ID NOT IN (104754,104534,104560,104705) AND
 wp_14578484_term_relationships.term_taxonomy_id IN
 (1194,11561,12084,1202,1203,1199,1196,1200,1197,1201,1204,5016,6745,6950,6744,6558,1195,1198,6746,13187)
 AND wp_14578484_posts.post_type IN ('post', 'page', 'attachment',
 'calendar_event', 'listicle', 'background', 'top-list', 'guide',
 'gallery', 'lead', 'personality', 'show', 'station', 'breaking') AND
 (wp_14578484_posts.post_status = 'publish' OR
 wp_14578484_posts.post_status = 'private') ORDER BY
 wp_14578484_posts.post_date DESC LIMIT 0, 15
 }}}

 That query returns duplicate posts.  If a post belongs to more than one of
 the terms in the IN() then the post will be duplicated.

 Query created with this call:

 {{{
 query_posts(array('category_name'=> 'a_slug',
 'post__not_in'=>$exclude_ids, 'paged'=>get_query_var('paged')))
 }}}

 Also notice all of those post types.  In 3.0 only the 'post' post_type is
 queried.  That could be unrelated to this ticket though.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12891#comment:133>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list