Forums

Excluding Category Logic Changed After Upgrade (2 posts)

  1. Ben
    Member
    Posted 6 months ago #

    I just upgraded one of my WordPress sites from 2.7.1 to 3.2.1.

    Here is a simplified version of my category structure with face ID numbers:
    Main Category 1 (ID 1)
    Main Category 2 (ID 2)
    -Sub Category 1 (ID 3)
    --Sub Category 2 (ID 4)
    ---Sub Category 3 (ID 5)

    I use query_posts($query_string . "&cat=-3"); on my theme's index.php to exclude posts in "Sub Category 1" and any of it's sub categories from my main news feed.

    Before my upgrade to version 3.2.1, if I had a post that was put into categories "Sub Category 3" and "Main Category 1", the post would show in my main news feed because one of the categories (Main Category 1) was not in the exclude list. This is how I wanted it to function.

    After my upgrade, that same post is not being shown on my main news feed. When I remove "Sub Category 3" from the post, it displays on my main news feed. It looks like the logic in this version has changed. Now, if a post has a category that is in the exclude list, it will not be displayed even if it also has a category that is supposed to be displayed.

    Is this a bug or was this change intentional? If it's intentional, what can I do to get it back the way it used to be?

  2. Kimikaze
    Member
    Posted 6 months ago #

    I believe this is expected behavior. One solution in your case could be to include the categories you want to show instead of excluding the once you don't.

    Maybe something like query_posts($query_string . "&cat=1,2");

Reply

You must log in to post.

About this Topic