
內容簡介
WordPress REST API 是一個很好的資源,但是如果您不想使用它,您可能想要關閉這個入口到您的 WordPress。
不同於其他受歡迎的外掛程式,它的目標是禁用 REST API,但僅在收到請求時返回由 REST API 處理的錯誤,這個插件預設情況下會刪除所有與 WordPress REST API 相關的篩選器和操作,並為發送到 REST API URL 終點的請求返回 404 錯誤,有效地阻止任何使用 REST API。
您可以在「設定」-「一般」頁面中選擇「僅限已登入的使用者」設置 REST API 設置,以進行較小的操作,從而保持 REST API 存取功能,但要求使用者已登入才能接受請求。
如果您對此外掛程式感到滿意,請不要忘記給予好評鼓勵,這將激勵我繼續分享和改善這個外掛程式(以及其他外掛程式)。
支援:如果您有任何支援問題,請在 Github 存儲庫中建立問題。
要求
需要 WordPress 4.7 或更高版本。
功能
透過刪除所有與 WordPress REST API 相關的篩選器和操作,並為發送到 REST API URL 終點的請求返回 404 錯誤(例如 https://example.com/wp-json/whatever)真正禁用 WordPress 核心的 REST API。
選擇性地,可以要求使用者已登入才能使用 REST API,而不是完全禁用它。
使用方法
要完全禁用 REST API,只需從「外掛程式」頁面安裝並啟用該外掛程式。
如果您不想禁用 REST API 但要求使用者已經登入,請前往「設定」-「一般」頁面,並將 REST API 設置選擇為「僅限已登入的使用者」,然後點擊「保存更改」。
如果您想再次禁用 REST API,可以將選項改回「關閉」。
如果要恢復 WordPress 的默認設置,只需停用該外掛程式。
外掛標籤
開發者團隊
原文外掛簡介
The WordPress REST API is a great resource, but if you don’t want to use it probably you will want to close this door to your WordPress.
Unlike other popular plugins that aims to disable the REST API but only return an error, processed by the REST API, when a request is received, by default, this plugin removes all filters and actions related to WordPress REST API, and returns a 404 error for requests sent to the REST API URL endpoints, effectively blocking any use of the REST API.
Optionally you can set the REST API setting in Settings -> General page to “Logged In Only” for a less drastical action, to keep REST API access enabled but require the user to be logged in to accept the requests.
If you’re happy with the plugin please don’t forget to give it a good rating, it will motivate me to keep sharing and improving this plugin (and others).
SUPPORT: If you have any support question, please create an issue at the Github repository.
Requirements
WordPress 4.7 or higher.
Features
Disable WordPress core REST API for real by removing all filters and actions related to it and returning a 404 error for requests sent to REST API URL endpoints (e.g. https://example.com/wp-json/whatever ).
Option to require user to be logged in to use the REST API instead of completely disable it.
Usage
To disable the REST API completely simply install the plugin from the Plugins page and enable it.
If you don’t want to disable the REST API but require user to be logged in instead, go to Settings -> General page and set the REST API to option to “Logged In Only”, and click Save Changes.
You can change the option back to “Off” if you want to disable the REST API again.
To return to WordPress default, simply deactivate the plugin.
