Exclude Categories From WordPress Feeds
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:
https://www.ghacks.net/index.php?cat=23
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:
https://www.ghacks.net/feed/?cat=-23
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:
https://www.ghacks.net/feed/?cat=-23&cat=-9592
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:
https://www.ghacks.net/feed/?cat=-28,-7724,-11447,-30
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.
Advertisement
I have been Googling for over an hour to find this information. Google of 2024 prioritizes garbage clickbait WordPress SEO garbage over actual information like this. Thank you for providing this clearly and including the updated 2012 format, which is still working fine for feed category exclusions in 2024.
The code used to exclude multiple categories from feeds doesn’t work. :( However, if you changed it to this, it works:
http://domain.com/feed?cat=-x,-y,-z
Hi, would you know by any chance how to do that with tags? These don’t work:
https://www.ghacks.net/feed/?tag=-14
https://www.ghacks.net/feed/?tag_ID=-14
Tx for any advice!
David i have not found a way to do that.