【问题标题】:Filter request per category WordPress Rest Api按类别过滤请求 WordPress Rest Api
【发布时间】:2017-06-28 19:33:45
【问题描述】:

是否可以按类别过滤使用 WordPress REST API 发出的 GET 请求的结果?在这种特殊情况下,我想检索特定作者在特定类别中的帖子,因为该作者写了很多文章,而我对某一类别的帖子感兴趣。我尝试在 http url 中使用 categories,但它不能与 authorposts 关键字结合使用。

这是我目前的网址:http://mysite.it/wp-json/wp/v2/posts?author=1

感谢您的帮助。

【问题讨论】:

    标签: php wordpress rest


    【解决方案1】:

    如果您希望作者 ID 为 1 或 2 在类别 5 或 4 中发帖,请执行以下操作:

    http://mysite.it/wp-json/wp/v2/posts?author[]=1&author[]=2&categories=5,4
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-12
      • 1970-01-01
      • 2021-06-03
      • 2012-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-25
      相关资源
      最近更新 更多