WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

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.

share|improve this answer

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

share|improve this answer
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. – Sledge81 Jul 1 '11 at 8:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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