WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Meitar
    Member
    Posted 5 years ago #

    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.

  2. Meitar
    Member
    Posted 5 years ago #

    Bump.

    Anyone…?

  3. rodsherwin
    Member
    Posted 5 years ago #

    I too have run into this problem in 2.6.1 even after using the fix previously mentioned in this forum post which is now a year and many wordpress versions old.

Topic Closed

This topic has been closed to new replies.

About this Topic