1

How do I exclude a particular category in the API?

For all categories - I may use the following:

https://www.example.com/?rest_route=/wp/v2/posts&per_page=100

What if I need across all the categories except for category-10?

I am using JavaScript at the front.

Thanks

1 Answer 1

1

I just figured it out, just in case it might be helpful for anyone in future:

There is an option available to exclude a particular category - categories_exclude

So, the new rest API would be:

https://www.example.com/?rest_route=/wp/v2/posts&per_page=100&categories_exclude=10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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