3 Ways to Exclude Content from WordPress Feeds
This may surprise you, but I post quite a bit of content that never appears in the site’s main feed. It is my impression that a vast majority of subscribers are interested in web/graphic-design and development-related topics, and are really much less interested (if at all) in the miscellaneous odds and ends that wind up in the ever-expanding Perishable Press database.
In the past, the process of excluding content from the main feed typically involved changing the post-date to something at least a year or so in the past. The thinking was that I could always return to these posts at some point in the future and put them back into sequential order. Although effective, this process quickly became far too tedious and time-consuming to prove practical. Keeping my eyes open for possible solutions, I have accumulated several excellent techniques for excluding content from WordPress feeds.
Excluding categories without a plugin
The first method I discovered involves excluding one or more categories from the feed by simply editing the feed URL itself. As Jaypee explains, it is possible to exclude any category n
by appending a query string to the feed URL like so:
http://domain.tld/feed?cat=-n
..where n
is the ID of the specific category you wish to exclude. Likewise, it is also possible to exclude multiple categories x
, y
, z
as follows:
http://domain.tld/feed?cat=-x&cat=-y&cat=-z
..where x
, y
, z
represent any three excluded categories, etc.
Of course, the upside to this method is that it doesn’t require a plugin in order to work. You can simply link directly to the filtered feed, invoke some htaccess voodoo, or even make the required changes via Feedburner, if that’s your thing. The only real downside involves potential loss of subscribers after switching the feed URL, but again, this may be easily resolved via htaccess or Feedburner.
Excluding categories with a plugin
If you would like to exclude categories without fiddling with your feed URL(s), check out the Ultimate Category Excluder plugin from Michael Clark. According to Michael, the Ultimate Category Excluder plugin “allows you to quickly and easily exclude categories from your front page, archives, and feeds.”
But it’s even better than that: for each excluded category, you have granular control over where the category’s posts are excluded. So you could exclude your “Milk” category from feeds only, your “Monkeys” category from both archives and feeds, and your “Pancakes” category from all three (front page, archives, and feeds). It’s entirely up to you and completely configurable via the WordPress Admin. Most importantly, though, this plugin is an excellent way to exclude category content from feeds.
Exclude individual posts
Rather than excluding an entire category from appearing in feeds, you may prefer granular control over individual posts. The Stealth Publish WordPress plugin by coffee2code prevents “specified posts from being featured on the front page or in feeds.” After installing the plugin, simply “unfeature” any post by assigning a “stealth-publish
” custom-field value of “1”. All such unfeatured posts will be excluded from all feeds as well as the front page.
I’m currently using this plugin here at Perishable Press and it works perfectly :)
..and I’m out!
Using one of these techniques, excluding content from your site’s main feed is a snap. If you know of other techniques, please share them by leaving a comment below. Thanks!
11 responses to “3 Ways to Exclude Content from WordPress Feeds”
Thanks. That was a very useful information. However, I guess the first solution won’t work if someone subscribed to feed before you changed the url, which is my case.
Actually, I have just tried Ultimate Category Excluder plugin and it didn’t work in WordPress 2.6. I had to unistall it.
Thanks for the info, jeeremie. Hopefully Michael will update the plugin soon. In the meantime, check out the Stealth Publish Plugin (third option). I use it here at Perishable Press and just love it. Hopefully it works with the latest version of WordPress.
The code used to exclude multiple categories from feeds doesn’t work. :( However, if you changed it to this, it works:
http://domain.tld/feed?cat=-x,-y,-z
Thanks for the heads up, Mimi! I think the difference in format has to do with different versions of WordPress. I have updated the article to reflect this information. Thanks for sharing with us! :)
Thanks for posting about the Stealth Publish plugin — just what I needed for my site. Works perfectly!
Thanks for the great info. I’m just looking for this. I plan to use Stealth Publish WordPress plugin together with RSS Includes Pages plugin, to be able to select which page to be included in my RSS.
Actually, when using default query-string format for your URLs instead of permalinks, you may exclude categories from most WordPress feeds via any of their associated parameters, category name, category ID, or any combination thereof. Here are some examples:
http://domain.tld/feed?cat=-bananaz
http://domain.tld/feed?cat=-bananaz&cat=-33
http://domain.tld/feed?cat=-33&cat=-77
http://domain.tld/feed?cat=-bananaz&cat=-pancakes
And so on, etc. and and and. So much fun, you forget to breathe sometimes.
What if want to do the opposite. For example I’m aggregating content from a couple of friends using Feedburner and the FeedWordPress pluggin. I only want to include content of a certain tag or category instead of excluding categories as I may not know what categories are available from the feed. So if its category “video production” then display…if not then ignore. I’m asking the contributors to tag or categories their content with a certain term and if that term exists then display otherwise ignore post. Help!!
excluding with the category’s slug (like ?cat=-tweet) does not seem to work on my wordpress 2.7.1 install
however, here is a plugin that works: http://www.codehooligans.com/2008/04/27/simply-exclude-plugin/
Thanks for the tips, very helpful. Was able to exclude a category from my main feed without a plugin! Much appreciated :)