Can anyone tell me why sticky posts are not being displayed at the top of the following query:

$wp_query = new WP_Query(array(
 'post_type' => 'post',
 'category__in'=>array( 5,140,430 ) 

It was working fine until I added the 'category__in'=>array( 5,140,430 ) parameter, but the stick posts are in category 430 so I don't see why they would suddenly stop appearing at the top?

Edit: This appears to be a long-standing wordpress issue between category__in and sticky posts. Wordpress codex says stickies should always appear on the front page, but seeing as how this is on the front page and doesn't work it must be a bug.

  • What is $blog_order? Jul 16, 2014 at 8:07
  • DESC and also irrelevant in the sense that if you take it out you get the same result. There appears to be a conflict between category__in and sticky posts. Jul 16, 2014 at 16:56
  • Was just wondering. You should always add all relevant info to your question Jul 16, 2014 at 16:58
  • Add that edit as an answer and accept it. You can score yourself some reputation Jul 16, 2014 at 17:04
  • I'm not concerned with reputation. I'm concerned with solving the problem and offering future users workarounds. I've accepted Nabha's workaround. Jul 17, 2014 at 22:45

1 Answer 1


I don't have direct experience with this, but from what I read...

Sticky posts don't show up by default on category pages, so adding the categories may throw the query into an "I don't care about sticky posts" mode.

You could try running a query first that just grabs the sticky posts, using arguments like this:

    $sticky = get_option( 'sticky_posts' );
    $args = array(
        'post__in'  => $sticky,
        'ignore_sticky_posts' => 1

You may be able to include category__in there as well, to get only sticky posts from the categories you want. Again, I haven't tried it, but it's a good avenue of approach.

More information:

  • 1
    Thanks, this appears to be a long-standing issue / bug between category__in and stick posts. I'd venture it's a bug because wordpress docs say stickies should always work on the front page but this is not the case. google.com/#q=category__in+and+stick+posts Jul 16, 2014 at 16:59
  • I'm accepting this as an answer because it offers a workaround to the bug. Jul 17, 2014 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.