WP REST API: filter by category 1 AND category 2

I have been meddling with REST API and I am stuck with this: How can I filter posts in both cat1 and cat2?

For now, ?categories[]=45&categories[]=50 returns in category ID 45 OR 50 – how can I get posts in 45 AND 50?

Thanks in advance.

9

Multiple categories can be separated by comma like below

http://example.com/wp-json/wp/v2/posts?categories=20,30

hope this helps

Leave a Comment