[wp-trac] [WordPress Trac] #25815: Sticky Posts don't work with category__in query

WordPress Trac noreply at wordpress.org
Wed Jan 29 23:02:11 UTC 2014


#25815: Sticky Posts don't work with category__in query
--------------------------+----------------------
 Reporter:  thezuberat    |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Query         |     Version:
 Severity:  major         |  Resolution:  invalid
 Keywords:  stickies      |     Focuses:
--------------------------+----------------------
Changes (by wonderboymusic):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Any `tax_query`-like thing negates `is_home()`, which is never true when
 `is_archive()` is true, which is true because `is_category()` is true.
 Your best bet is to display sticky-by-category posts in your template
 using a subquery:

 `new WP_Query( array( 'post__in' => get_option( 'sticky_posts' ),
 'category__in => ....  )`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25815#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list