Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

In your functions.php add:

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

add_filter('pre_get_posts','excludeFeedCats');

Or use Simply Exclude for more flexibility.

share|improve this answer
add comment

Your Answer

 
discard

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.