4 Ways to Exclude WordPress Category from RSS Feeds
Lately, I wanted to exclude a few categories from WordPress Feeds. A search on WordPress didn’t return any valuable information. So, I searched the Google database. Here’s what I found:
1- Change the feed URL
The most common and maybe easier way to do so is to change your feed structure. In the default WordPress theme, the RSS link (in footer.php) is:
1 | <a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a> |
You can exclude any category by appending a query string to the feed URL, like this:
1 | <a href="<?php bloginfo('url'); ?>/feed?cat=-3&cat=-12">Entries (RSS)</a> |
‘12‘ in this example is your category ID. In older version of WordPress, the category IDs were displayed in Manage -> Categories, next to category name. However, in WordPress 2.5+, the WordPress Gurus removed this feature (only god knows why). To identify the category ID, mouseover the category name to see its ID in the status bar of your browser. Otherwise, you can install Reveal IDs for WP Admin 2.5 plugin to reveal the post, page and category IDs.
A more common PHP structure might work as well:
1 | <a href="<?php bloginfo('url'); ?>/feed=rss2&cat=-3,-12">Entries (RSS)</a> |
If you are using RSS2, your code will be:
1 | <a href="<?php bloginfo('url'); ?>/feed=rss2&cat=-3&cat=-12">Entries (RSS 2)</a> |
Depending on your permalink structure, you might need to add index.php to your feed url:
1 | <a href="<?php bloginfo('url'); ?>/index.php?feed=rss2&cat=-5">Entries (RSS 2)</a> |
2- Exclude categories in your template’s functions.php file
Jangro explains how to exclude a category from feed by adding a few lines of code to the template’s functions.php file:
1 2 3 4 5 6 7 8 | function myFeedExcluder($query) { if ($query->is_feed) { $query->set('cat','-12'); } return $query; } add_filter('pre_get_posts','myFeedExcluder'); |
This code will keep the category ID=”12″ out of the feed. If you want to exclude more than one category, put them in separated by commas ‘-12,-25,-33′.
3- Add a plugin to WordPress
If you are not into coding, you can install the Ultimate Category Excluder plugin. It allows to exclude any categories from your front page, archives, and feeds. Once you installed it, go to the Category Exclusion page in your admin panel to exclude a category by selecting one. That is that easy.
You can also install the Stealth Publish plugin to exclude a specific post from being published in feeds.
4- Exclude category from RSS feeds in FeedBurner
If like me you are using FeedBurner, go to dashboard and click “Edit Feed Details”. In the field “Original Feed”, enter the feed URL with the categories you want to exclude as explained in first step above.

Conclusion
The methods described above would be interesting to implement if you write about two (or more) different topics on your site. Let’s say you write about Linux (which would be ID=”1″ in our example below) and Windows (ID=”2″). Some of your readers might want to read your Linux articles but not the Windows ones, and vice-versa. Thus, you could create two feed links, the first one excluding Windows feeds for your Linux reader and the second one the Linux feeds:
1 2 | <a href="http://yourdomain.com/feed?cat=-2">Subscribe to Linux Feed</a> <a href="http://yourdomain.com/feed?cat=-1">Subscribe to Windows Feed</a> |
The Author
Want to become a guest author on this blog?





Jeffro2pt0 says:
24 Oct, 2008
Question regarding this action. Would any of these 4 methods allow me to import a WXR file that contained a few categories from showing up in the feed reader? I don’t want my current subscriber base of 500 to be bombarded with new posts when I import a WXR file into my existing installation.
Peter S says:
9 Jan, 2009
Thanks so much. It is just what I’m looking for
Darren Sproat says:
24 Mar, 2009
THANK YOU!
I have been looking for category exclusion code for controlling what is displayed on the default/home/front pages for what seems like ages! Like you, a search on wordpress didn’t turn up the results I was looking for… a move to google found your site and the info should allow me to do what I need to do…
Thanks again,
Darren Sproat
Waterman pens says:
1 Apr, 2009
Woww, Thank you brother . Very good theme .
Prearlinuri says:
17 Apr, 2009
nice, really nice!
Steve G. says:
25 Jan, 2010
Thanks for sharing. That’s the tutorial I’m looking for!
Bouncy Castle Hire Weston-Super-Mare says:
14 Feb, 2010
thank you for this exclude categories, but i want to exclude the main default one…. thank you
Bad Bone says:
26 Feb, 2010
Nice article..I tell my friend to read this and bookmark..
Allen says:
13 Jul, 2010
Thank you. I’ve been trying to hide my slider and photo gallery category rss feeds by using plugins, but they caused more confusion. Finally I found your article and after a while, got it to work perfectly.
Appreciate your help…. too bad I’m gonna get all the credit for this.
Thanks Jeremie.