[WordPress] 外掛分享: REST API Enabler

前言介紹

  • 這款 WordPress 外掛「REST API Enabler」是 2015-10-08 上架。
  • 目前有 200 個安裝啟用數。
  • 上一次更新是 2016-07-04,距離現在已有 3226 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.5 以上版本才可以安裝。
  • 有 3 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

mcguive7 |

外掛標籤

api | post | rest | type | custom |

內容簡介

喜歡這個外掛嗎? 請考慮給予 五星評價。

預設情況下,自訂文章類型和自訂欄位無法透過 WordPress REST API 存取。REST API Enabler 可讓您:

啟用 WP REST API 以存取自訂文章類型,並指定 WP REST API 自訂端點。
為文章、頁面和自訂文章類型選擇要包含在 WP REST API 回應中的自訂欄位。

在 REST API 回應中,所有啟用的自訂欄位資料都會以 rest_api_enabler 金鑰嵌套,如下所示:

[
{
"id": 179,
"date": "2016-07-03T18:06:50",
"title": {
"rendered": "Test Job"
},
.
.
.
"rest_api_enabler": {
"custom_meta_1": "Value 1",
"custom_meta_2": "Value 2",
"custom_meta_3": [
"Array value 1",
"Array value 2"
]
}
}
]

注意:在版本 1.1.0 之前,所有元資料鍵名都會被包含在 API 回應的頂層金鑰中。此外,無論原始值是否為陣列,所有值都將返回為陣列。這個功能現在已被標記為過時,因為它會造成鍵名衝突的風險。請改參考 rest_api_enabler 的頂層金鑰。

用法

啟用外掛,然後前往管理後台的「設定」→「REST API Enabler」。
按一下「文章類型」選項卡,以啟用/停用文章類型並自訂其端點。
按一下「文章屬性」選項卡,以啟用/停用文章屬性(自訂欄位)。

注意:預設情況下,此外掛不會顯示保護的文章屬性(以底線開頭且僅用於內部使用的文章屬性)的設定。如果您希望在外掛設定中包含保護的文章屬性,可以使用 rae_include_protected_meta 過濾器來實現。以下的代碼可以放置在你的佈景主題的 functions.php 檔案中,或者在自訂外掛中使用(在 init 優先級為 10 或更早之前):

add_filter( 'rae_include_protected_meta', '__return_true' );

原文外掛簡介

Like this plugin? Please consider leaving a 5-star review.
By default, custom post types and custom fields are not accessible via the WordPress REST API. REST API Enabler allows you to:

Enable the WP REST API for custom post types and specify WP REST API custom endpoints.
Choose which custom fields to include in WP REST API responses for posts, pages, and custom post types.

All enabled custom field data is included in the REST API response, nested under the rest_api_enabler key, like so:
[
{
"id": 179,
"date": "2016-07-03T18:06:50",
"title": {
"rendered": "Test Job"
},
.
.
.
"rest_api_enabler": {
"custom_meta_1": "Value 1",
"custom_meta_2": "Value 2",
"custom_meta_3": [
"Array value 1",
"Array value 2"
]
}
}
]

Note: prior to verion 1.1.0, all meta keys were included as top-level keys in the API response. Additionally, all values were returned as arrays, regardless of whether the original value was actually an array. This functionality is now deprecated as it risks key-name collisions. Please reference the rest_api_enabler top-level key instead.
Usage

Activate the plugin, then go to Settings → REST API Enabler in the admin.
Click the Post Types tab to enable/disable post types and customize their endpoints.
Click the Post Meta tab to enable/disable post meta (custom fields).

NOTE: by default, the plugin does not display settings for protected post meta (post meta that begins with an underscore and is intended for internal use only). If you wish to include protected post meta in the plugin settings, you can use the rae_include_protected_meta filter to do so. The following code can be placed in your theme’s functions.php file, or in a custom plugin (on init priority 10 or earlier):
add_filter( 'rae_include_protected_meta', '__return_true' );

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「REST API Enabler」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | 1.0.1 | 1.0.2 | 1.1.0 | trunk |

延伸相關外掛(你可能也想知道)

  • InfiniteWP Client 》InfiniteWP 可讓使用者從自己的伺服器管理無限數量的 WordPress 網站。, 主要功能:, , 自行託管系統:位於您自己的伺服器上,完全受您控制, 一鍵更新所有網站...。
  • WP Consent API 》WP Consent API 是一個外掛,可以標準化插件之間同意的同意類別溝通。它需要使用 Cookie 標語插件和至少一個支援 WP Consent API 的其他插件。, , 有了這個插...。
  • Disable REST API 》這是最全面的 WordPress REST API 存取控制外掛!, 輕鬆安裝,安裝後不需要額外設定即可使用。只需上傳並啟用,整個 REST API 將無法被一般訪客存取。, 但如...。
  • Mailgun for WordPress 》Mailgun 是超過10,000名網站和應用程式開發人員信任的電子郵件自動化引擎,用於發送、接收和追踪郵件。藉助Mailgun強大的郵件API,開發人員可以更多時間建立...。
  • Make Connector 》Make 是一個視覺化平台,讓你可以在幾分鐘內設計、建立和自動化任何事情 - 從簡單的任務到複雜的工作流程。使用 Make,你可以在 WordPress 和數千個應用程式...。
  • ACF to REST API 》此 WordPress 外掛在WordPress REST API中提供了Advanced Custom Fields的端點, 詳細資訊請參閱GitHub:https://github.com/airesvsg/acf-to-rest-api/。
  • WordPress REST API Authentication 》WordPress REST API 預設是鬆散的端點,駭客可以通過這些端點遠程控制您的網站。 您不希望駭客可以透過 WordPress 登錄和 WordPress 註冊或任何其他端點來獲...。
  • Disable WP REST API 》這個外掛只有一個功能:禁用沒有登入 WordPress 的訪客使用 WP REST API。不需要任何設定。, 這個外掛只有 22 行短小的程式碼(少於 2KB)。因此它非常輕量、...。
  • WPGet API – Connect to any external REST API 》簡單地連接WordPress至外部API的最簡單方式。, , WPGetAPI 可輕鬆地從無限量的第三方 REST API 發送和接收資料,然後使用「Shortcode」或「Template Tag」格...。
  • WP REST Cache 》如果您在使用 WordPress REST API 時遇到速度問題,這個外掛將允許 WordPress 快取 REST API 的回應,使其更快。, 此外掛提供以下功能:, , 快取所有預設的 W...。
  • WP REST API Controller 》WP REST API Controller 外掛提供使用者易用的圖形化介面,使管理員可以切換 WordPress 核心和自訂文章類型以及分類法的可見性和端點,同時也可以自訂 API 回...。
  • WordPress REST API (Version 2) 》WordPress 正轉變成一個完整的應用程式框架,因此需要新的 API。這個專案的目的是創建一個易於使用、易於理解且經過良好測試的框架,用於創建這些 API,以及...。
  • WP REST API – OAuth 1.0a Server 》使用這個外掛,您可以將應用程式連接至您的 WordPress 網站,而不必透露您的密碼。, 此外掛使用 OAuth 1.0a 協議,允許委派授權,即允許應用程式使用一組次要...。
  • Contact Form to Any API 》, 「Contact form 7 to Any API」是一款強大的外掛,能夠將聯絡表單 CF7 的數據傳送至任何第三方服務。使用者可以透過這款外掛將數據發送到客戶關係管理(CRM...。
  • Envato Toolkit 》這個外掛包含一個三個檔案的程式庫和視覺化介面,用於驗證客戶購買代碼、獲取特定 Envato 用戶的詳細信息(國家、城市、總追隨者數量、總銷量、頭像),獲取...。

文章
Filter
Apply Filters
Mastodon