Support » Fixing WordPress » WP_Query, showing specific category breaks sticky posts

  • It seems that when you make a custom query like this one, the sticky posts in category 1 will not show up first like they should.
    $custom_query = new WP_Query('cat=1');

    However, if you exclude other categories, the sticky posts function correctly.
    $custom_query = new WP_Query('cat=-2,-3,-4');

    While I want to show just the posts from category 1 in this query, excluding other categories is not an option – the customer would have to edit the query everytime new categories are created.

    Any ideas how to use WP_Query('cat=1'); and still make the stickies work? In my opinion this is a bug, or is anyone else seeing similar behaviour?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m seeing the same exact thing. I have an alternate loop which i just want to show the latest posts from the “news” category INCLUDING sticky posts that are at the top of the list.

    So now, I have to edit that query everytime the staff adds a new category so I have a big messy list of all the categories NOT to include even though I’m only including one. Anytime I tried to use a simpler, more accurate query using “cat=9” the sticky posts are no longer showed. Anyone have any tips around this?

    I’ve got exactly the same problem, there’s nobody have a solution for that ? 🙁

    Same problem. No fix yet?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_Query, showing specific category breaks sticky posts’ is closed to new replies.