WordPress.org

Support

Support » How-To and Troubleshooting » Code to exclude posts from showing in Loop used to work in 2.5.1, broke in 2.6?

Code to exclude posts from showing in Loop used to work in 2.5.1, broke in 2.6?

  • Hi all. I have a blog for which I was using the code detailed in this post to arbitrarily exclude posts from showing up on the homepage based on whether they were in a certain category and had a certain prefix to their title. I made no changes to this code (which is in a custom theme) and then updated my WP installation from 2.5.1 to 2.6.

    The same code was working with 2.5.1 as expected, but has broke in 2.6 and two hours of debugging and lots of searches later, I still can’t figure out why. All of my var_dumps() tell me things are just as they were in 2.5.1, and yet instead of showing the correct number of non-excluded posts from my homepage, I’m only seeing the amount within the first value passed to showposts.

    As an example, say that I have $wp_query->post_count = 10 (set via the WP admin screens) and 9 of the latest 10 posts should be excluded based on my code linked above. Instead of seeing 10 posts on my homepage, I only see 1 (10-9=1), even though $my_new_query->post_count correctly contains the count of 19 and there are, indeed, 19 posts (the correct ones) in the $my_new_query->posts array.

    What’s going on? What have I missed, or…worse, what has 2.6 broken?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Code to exclude posts from showing in Loop used to work in 2.5.1, broke in 2.6?’ is closed to new replies.
Skip to toolbar