我使用Wordpress rest api来查询类别id,如下所示:
http://localhost:8888/wp-json/wp/v2/posts?type=press_release&per_page=4&categories=15,25
返回cat 15或cat 25格式的结果
我只需要返回结果,如果它们在cat 15和25中。
做了大量的搜索,但找不到解决方案。
有没有人知道这是不是可以做到,以及如何做到?
谢谢,杰米
发布于 2019-10-26 07:41:45
与+交换,
&categories=15+25
更新:
实际上,这似乎并不像您期望的那样工作,https://core.trac.wordpress.org/ticket/41287
如果上述方法不起作用,则必须使用带有回调函数的register_rest_route创建自定义端点,并使用category__and参数返回带有新WP_Query的posts
https://stackoverflow.com/questions/58539207
复制相似问题