最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

posts - exclude particular category in api

programmeradmin0浏览0评论

How do I exclude a particular category in the API?

For all categories - I may use the following:

/?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

How do I exclude a particular category in the API?

For all categories - I may use the following:

https://www.example/?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

Share Improve this question asked May 28, 2020 at 14:26 newnew 214 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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/?rest_route=/wp/v2/posts&per_page=100&categories_exclude=10
发布评论

评论列表(0)

  1. 暂无评论