2

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?

5
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.

  • 1
    The second AND example only fetched cat2 on my install, did that work for you as expected? Maybe it's just my install that's not working ;-) – birgire Mar 9 '17 at 16:57
  • 1
    No, it does not work. I should test it before posting. I've edited the answer. – Max Yudin Mar 9 '17 at 18:33
  • @henrywright, please see the edited answer. – Max Yudin Mar 9 '17 at 18:36
  • Thanks for updating, and thanks to @birgire for noticing the problem. – henrywright Mar 9 '17 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.