內容簡介
WordPress Rest Api V2 多內容類型查詢 API
將 wp/v2/posts API 擴展成支援多個文章類型的查詢
關於
想要在網站上獲取文章、頁面、文章、活動等嗎?
使用端點:‘/wp-json/wp/v2/multiple-post-type’
列表:
對 `/wp-json/wp/v2/multiple-post-type?&type[]=post&type[]=page` 發出 GET 請求
以 slug “about-me” 為名的頁面:
發出 GET `/wp-json/wp/v2/multiple-post-type?slug=about-me&type[]=post&type[]=page` 請求
搜索詞 “awesome”:
發出 GET `/wp-json/wp/v2/multiple-post-type?search=awesome&type[]=post&type[]=page&type[]=articles<h3>Credits</h3>` 請求
使用 Ruben Vreeken(https://github.com/Rayraz) 在 stackoverflow(http://stackoverflow.com/questions/38059805/query-multiple-post-types-using-wp-rest-api-v2-wordpress)上分享的代碼構建
許可證
GPLv3
外掛標籤
開發者團隊
② 後台搜尋「WP Rest Api V2 Multiple PostTypes」→ 直接安裝(推薦)
原文外掛簡介
Multiple Content type Query API for WordPress Rest Api V2
Extension of wp/v2/posts api to allow query multiple post types
About
Want to get your site’s posts, pages, articles, events?
Use the Endpoint: ‘/wp-json/wp/v2/multiple-post-type’
List:
GET request to `/wp-json/wp/v2/multiple-post-type?&type[]=post&type[]=page`
Get the page with slug “about-me”:
GET /wp-json/wp/v2/multiple-post-type?slug=about-me&type[]=post&type[]=page
Search term “awesome”:
GET /wp-json/wp/v2/multiple-post-type?search=awesome&type[]=post&type[]=page&type[]=articles
Credits
Build using the code shared by Ruben Vreeken, (https://github.com/Rayraz)
on stackoverflow (http://stackoverflow.com/questions/38059805/query-multiple-post-types-using-wp-rest-api-v2-wordpress)
License
GPLv3
