Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#25815 closed defect (bug) (invalid)

Sticky Posts don't work with category__in query

Reported by: thezuberat Owned by:
Milestone: Priority: normal
Severity: major Version:
Component: Query Keywords: stickies
Focuses: Cc:

Description (last modified by johnbillion)

If the category__in argument is used for the query (query_posts(), etc.) the sticky posts do not work anymore. See:

This is imo a major issue because you can't create category specific queries which support sticky posts atm.

Change History (4)

#1 @johnbillion
8 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
8 years ago

  • Component changed from General to Query

#3 @wonderboymusic
8 years ago

  • Keywords stickies added

#4 @wonderboymusic
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

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 => .... )

Note: See TracTickets for help on using tickets.