I recently had need of an RSS feed which included all posts in one category, but which excluded the posts in a sub category. In other RSS feeds I did want this category still included so I needed to be careful how I went about sorting out this feed.
I was expecting this not to be possible, but when I did some exploring I discovered that you could exclude post assigned to a specific category from a feed.
In the RSS feed URL, you can add ?cat=-{category number}
where {category number} is the number of the category to be excluded.
This is the structure of the feed URL for a {named category} which excludes a specific {category number to exclude}:
https://www.azurecurve.co.uk/category/{named category}/feed/?cat=-{category number to exclude}
For example, if I wanted to use my ClassicPress feed, the feed URL would be:
https://www.azurecurve.co.uk/category/content-management-systems/classicpress/feed/
But if I wanted to exclude posts assigned the Plugins category, I would use this feed URL with a cat
URL parameter:
https://www.azurecurve.co.uk/category/content-management-systems/classicpress/feed/?cat=-1089
Multiple categories to exclude can be specified in the URL parameters, separated with commas (e.g. ?cat=-10,-20
).
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.