[WordPress] 外掛分享: REST API Search

首頁外掛目錄 › REST API Search
30+
安裝啟用
★★★★★
5/5 分(1 則評價)
3550 天前
最後更新
問題解決
WordPress 4.4+ v1.4 上架:2016-04-06

內容簡介

REST API 搜尋

僅適用於 REST API 外掛的第 2 版本

這個外掛提供了在 WordPress REST API 中缺失的搜尋功能。
當前 REST API 第 2 版本的問題是,你只能基於每個文章類型搜尋。

/wp-json/wp/v2/posts?filter[s]=apples

/wp-json/wp/v2/pages?filter[s]=apples

這個外掛的功能

為除了修訂版本和設為「exclude_from_search」的類型的所有文章類型添加搜尋功能。

/wp-json/wp/v2/search/apples

如果是多個單字,只需用加號取代空格。

/wp-json/wp/v2/search/apples+pears

還可輕鬆翻頁

第 2 頁:

/wp-json/wp/v2/search/apples+pears/2

第 3 頁:

/wp-json/wp/v2/search/apples+pears/3

Github

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「REST API Search」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

REST API Search
This is only for Version 2 of the REST API Plugin
This adds the missing functionality of Search into the WordPress REST API.
The issue being with the current REST API Version 2, you can only search on a per post_type basis.
/wp-json/wp/v2/posts?filter[s]=apples

/wp-json/wp/v2/pages?filter[s]=apples

What this plugin does.
Adds the search functionality for all posts types except revisions and types with ‘exclude_from_search’ set to true.
/wp-json/wp/v2/search/apples

In case of a multi word string, just replaces the spaces with plus signs.
/wp-json/wp/v2/search/apples+pears

Also adds easy paging
page 2:
/wp-json/wp/v2/search/apples+pears/2

page 3:
/wp-json/wp/v2/search/apples+pears/3

Github

延伸相關外掛

文章
Filter
Apply Filters
Mastodon