這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

date_query enabler

描述

WP REST API plugin provides the ability to interact with a WordPress installation through a REST API. When retrieving posts, a use case would be to filter them based on they publish date by before/after a certain date. In WordPress this can be achieved using the date_query parameter. However, the parameter is not part of the whitelisted parameters of WP REST API. A workaround is to add it ourselves as discussed here. This plugin adds the date_query param to the whitelist not modifying the theme of WordPress but by using a very small and simple plugin. This allows to change and upgrade themes freely and still keep the whitelisting of the parameter.

After installing WP REST API and this plugin, you should be able to run queries like the below,

/wp-json/wp/v2/posts?filter[date_query][after]=2016-02-26T12:38:36
/wp-json/wp/v2/posts?filter[date_query][before]=2016-02-27T14:28:15

安裝

  1. Upload the plugin files to the /wp-content/plugins/date_query directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress

評價

閱讀全部2個評價

貢獻者及開發者

“date_query enabler” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。

貢獻者

將 date_query enabler 外掛本地化為台灣繁體中文版。

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

修改日誌

0.1

  • First version.