5

I notice that sticky posts will disregard the posts_per_page param? Like I have a query like

$q = new WP_Query(array( 'posts_per_page' => 4, ... ));

If there are 3 sticky posts, I will get 6 posts? (its abit strange tho why 6 not 7 (4+3)) I dont want to ignore sticky posts. How can I force the posts per page limit? eg, I have 10 sticky, I still get only 4 posts.

One way I can think of is a counter that counts to 4 and exit the loop. But there isnt a WP way? This appears to be more of a bug to me?

  • 4
    by using the ignore_sticky_posts argument you're not excluding them from the list, you're just treating them like normal posts. Isn't that what you want? – onetrickpony Jul 4 '11 at 11:08
  • More than one year later: Any progress on this topic? – kaiser Sep 23 '12 at 12:50
  • I cannot replicate this, seems to behave exactly as described wanted behavior. – Rarst Oct 8 '12 at 19:56
  • This is reproducible bug and is a known bug; being tracked at core.trac.wordpress.org/ticket/27282 – Will. Sep 25 '17 at 21:07

Browse other questions tagged or ask your own question.