Taken from WordPress Feeds:
You can include posts from one of multiple categories or tags in a
feed by comma-separating their values. For example:http://www.example.com/category/cat1,cat2/feed
You can include posts from all of multiple categories or tags in a
feed by adding to the end of the link. For example:http://www.example.com/category/cat1/category/cat2/feed
I understand the 2nd feed will include posts from both cat1 and cat2. The 1st feed looks, to me at least, as though it will do exactly the same. How do these feed URLs differ?
1 Answer
http://www.example.com/category/cat1,cat2/feed
will include posts belonging to cat1
OR cat2
, while
http://www.example.com/category/cat1/category/cat2/feed
will include posts belonging to both cat1
AND cat2
simultaneously. See the update below!
In the following example, the first RSS will include all posts, while the second – Post 3
and Post 4
only.
Category 1
|- Post 1
|- Post 2
|- Post 3
|- Post 4
Category 2
|- Post 3
|- Post 4
|- Post 5
|- Post 6
Updated!
Surprisingly, in spite of WordPress Codex instructions on finding RSS feed URL, the second feed URL shows only the last category mentioned in URL. The right formed URL for cat1
AND cat2
will look as follows:
http://www.example.com/category/cat1+cat2/feed
Thanks @birgire for drawing my attention to this.