DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Depending to your blog structure, it may be interesting to exclude some categories from your rss feeds. If you always wanted to find a clean way to do it, I’m pretty sure this recipe will make you happy.

Before starting to code, you’ll have to know the numeric ID of the categories you want to exclude. If you don’t know how to get the ID of a particular category, just read this recipe.

Once you have the ID of the categories you want to exclude from your rss feed, open the functions.php file from your theme. If your theme doesn’t have a functions.php file, create one.

Paste the following code in it:

function myFilter($query) {
    if ($query->is_feed) {
        $query->set('cat','-5'); //Don't forget to change the category ID =^o^=
return $query;


Credit goes to Scott Jangro for this awesome recipe!


  1. Great, that worked fine – thanks a lot!

    Do you happen to know how to hide/remove the WP native gallery images from the feed so that only the featured image is displayed..?


  2. Hi there

    Thanks for this. I want to exclude four categories from my general feed, but I do want to be able to allow the feed from those categories (they are one category plus three sub-categories) to appear in the category feed.

    If I follow your code, would this prevent the category feed from producing any entries?

  3. thanks
    but i want to remove categories Feed from browser menu
    how can i do that please

Leave a Comment

Your email address will not be published. Required fields are marked *