[wp-trac] [WordPress Trac] #16152: category__in now shows posts from children categories too

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 9 23:14:16 UTC 2011

#16152: category__in now shows posts from children categories too
 Reporter:  linuxologos       |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.1
Component:  Query             |     Version:  3.1
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |

Comment (by ryan):

 The change prevents only 'cat' from being processed again. I don't see a
 need to double process that.  The flag is cleared for subsequent query()
 calls made using the same object.

 Multiple tax queries are still possible. I tested with requests such as:

 $query = new WP_Query( array('tag_slug__and' => array('foo', 'bar',
 'test',), 'tag__in' => array( 3 ) ) );

 That creates two entries in the tax_query list. One of which is operator
 AND and the other IN.  These two have a 'relationship' of AND.  The
 resulting query is like:

 SELECT SQL_CALC_FOUND_ROWS wp_trunk_posts.* FROM wp_trunk_posts INNER JOIN
 wp_trunk_term_relationships ON (wp_trunk_posts.ID =
 wp_trunk_term_relationships.object_id) WHERE 1=1 AND (
 wp_trunk_term_relationships.term_taxonomy_id IN (12) AND wp_trunk_posts.ID
 IN (
 SELECT object_id
 FROM wp_trunk_term_relationships
 WHERE term_taxonomy_id IN (12,13,14)
 GROUP BY object_id HAVING COUNT(object_id) = 3
 ) ) AND wp_trunk_posts.post_type = 'post' AND (wp_trunk_posts.post_status
 = 'publish' OR wp_trunk_posts.post_status = 'private') GROUP BY
 wp_trunk_posts.ID ORDER BY wp_trunk_posts.post_date DESC LIMIT 0, 5

Ticket URL: <http://core.trac.wordpress.org/ticket/16152#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list