I'm trying to exclude certain categories from the mydomain.com/feed

Researching online I came across this code:

<a href="<?php bloginfo('url'); ?>/feed?cat=-3&cat=-12">Entries (RSS)</a>

Now the question is should I create a function (if yes what function to create) so I can exclude categories without having anyone to redirect to custom feed URLs

2 Answers 2


In your functions.php add:

function excludeFeedCats($query) {
    if ($query->is_feed) {
        $query->set('cat','-3, -12');
return $query;


Or use Simply Exclude for more flexibility.


Take a look on this plugin too Ultimate Category Excluder.i hope it'll helps you:)

  • Thanks for the tip. But I'm not a big fan of plugins anymore.. I already have around 30 plugins.. prefer to use php than plugins. Jul 1, 2011 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.