我想在WP-API中按類別搜索帖子。按類別搜索WordPress WP-API
我知道我可以通過屬性類別搜索帖子或過濾[貓]。
但帖子包含多個類別。
我試圖尋找這樣的:
{host}/wp-json/wp/v2/posts?categories=69&filter[cat]=[228,246,237]&per_page=50
或
{host}/wp-json/wp/v2/posts?categories=69&filter[cat]=228&filter[cat]=246&filter[cat]=237&per_page=50
或
{host}/wp-json/wp/v2/posts?categories=69&categories=246&categories=237&categories=228
這對我沒有工作。它導致搜索查找最後一個屬性。
任何想法?
這是JSON響應的結構
{
"id": 9333,
"date": "2016-08-02T14:17:01",
"date_gmt": "2016-08-02T12:17:01",
"guid": {
"rendered": "{post}/?p=9333"
},
"modified": "2016-08-03T08:50:35",
"modified_gmt": "2016-08-03T06:50:35",
"slug": "{post}",
"type": "post",
"link": "{host}/{post}/",
"title": {
"rendered": "{post}"
},
"content": {
"rendered": "{post}"
},
"excerpt": {
"rendered": "{post}"
},
"author": 3,
"featured_media": 0,
"comment_status": "closed",
"ping_status": "closed",
"sticky": false,
"format": "standard",
"categories": [
228,
237,
207,
217,
246,
231,
69,
221,
270,
244
],
"tags": [],
"_links": []
}
謝謝!
更改爲英語語言 - 並在代碼中包裝代碼 – dbmitch