WordPress.org

Support

Support » How-To and Troubleshooting » How to Exclude posts that belong to a special category?

How to Exclude posts that belong to a special category?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Just curious: if they don’t belong to the same “news” catgeory but to more than one cat… how do you display them on that special page? (Page?)

    moshu: They all belong to “News” category. Some of them (most of them actually) belong to other categories, additionally. I just display all the posts that belong to “News” on that special page.

    The problem is that I don’t want those posts to be included in ANY other page.

    This plugin helps you to exclude them from the frontpage (main index) for sure:
    http://ryowebsite.com/?p=46
    It might have other features, too – I don’t use it.
    Check it out.

    OK, I just read a bit about it: you can exclude from Archives, from being listed in the sidebar, from search.
    Where else do you want to exclude them?

    I’ll take a look at it. Actually I need to exclude the category from EVERYTHING. It would be ideal to have a special parameter to pass to a query to NOT EXCLUDE this category, and in all other cases to exclude it. Perhaps writing an own filter would be a better solution for that but I don’t know which function to filter in this case…

    Samuel B
    Participant

    @samboll

    @samboll

    This simply omits the post when already fetched. I need it to work on the database level, not the interface. Otherwise it screws up paging, sorting and all kinds of things. If I have just 1 normal post and 5 “news” posts, then on the home page I will see only this 1 post and link to “previous posts” and this is certainly not what I need.

    @moshu:

    I tested the category visibility plugin (http://ryowebsite.com/?p=46) and unfortunately it works the same as the default WordPress category filtering — it filters out only the posts that belong to ONLY ONE category. If a post belongs to 2 or more categories, and only one of them is selected to be filtered out, it shows the posts anyway, thus making it not useful to me.

    So, do you think there is no easy way to do this?

    OK I finally decided on creating a custom query. It’s well explained here: http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query
    and works just fine.

    Still, if anyone finds a simpler solution, I’ll be glad to hear it (I’m not marking the post as resolved).

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to Exclude posts that belong to a special category?’ is closed to new replies.