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

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 8 07:41:14 UTC 2011


#16152: category__in now shows posts from children categories too
--------------------------+-----------------------------
 Reporter:  linuxologos   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Until 3.0.4 category_in parameter of query_posts() does not show posts
 from any children of the categories given to it, as currently stated in
 the
 [http://codex.wordpress.org/Function_Reference/query_posts#Category_Parameters
 codex] too. In 3.1-RC2 it does show posts from child-categories.

 Let's say we have a category with some subcategories. Posts are assigned
 either to parent category '''or''' to children of the category (not both
 to parent and child). If we use

 {{{
 query_posts( array( 'category__in' => array($parent_category_id) ) )
 }}}

 in 3.0.4 only posts assigned to parent category are shown.
 But in 3.1 posts from parent as well as subcategories are shown with the
 same code.

 I'm not sure if it is a bug or just the way the parameter will work since
 3.1, but people using this parameter that way will possibly see their
 sites working unexpectedly after upgrading to 3.1.

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


More information about the wp-trac mailing list