I received an email from Matthew a few hours ago who asked if there was a possibility to exclude certain categories from my website from appearing in the RSS feed. I was really busy with a website that I purchased earlier this morning and could not answer immediately. The good news is that it is possible to exclude categories from WordPress RSS feeds.
The bad news is that it might not work with all WordPress blogs and that the user who wants to exclude the categories needs to know their category ID. The first problem is easier to solve. Excluding categories from WordPress feeds works if the WordPress blog is not using the Feedburner feed redirection plugin or a comparable plugin. The feed redirection plugin redirects all feed requests (no matter if they are category specific or the full feed) to an RSS service like Feedburner. This prevents that users can create individual feeds based on categories, authors or tags. It also prevents the exclusion of categories in the feed.
Finding out the category IDs of a WordPress blog is the second obstacle. Most webmasters use pretty permalinks which do not display IDs on the website. The only way to find out without asking the website owner is trial and error. Is is possible to open categories with their IDs in WordPress even if the Pretty Permalinks option is enabled. To open a category with a category ID one would open the following url in a web browser:
This would open the Linux category here at Ghacks. This can be a very time consuming process as I have seen categories with five digits. So its probably best to ask the administrator about the category IDs. (Feel free to post additional solutions in the comments).
To exclude categories from RSS feeds in WordPress one would use the following syntax:
This removes category 23 from the main feed of the website. It is possible to exclude multiple categories from the feed, simply append an & and another cat=-xx in the end:
This excludes the Linux and Mac categories from the RSS feed.
Update: The above option no longer works. To exclude categories from a WordPress feed use the following syntax:
where 28, 7724, 11447 and 30 are the categories you want to exclude. You can use the same methodology to merge category feeds into one. Just remove the - from the cats to do so.
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.