plugin-icon

Disable WP REST API

作者 Jeff Starr·
針對未登入至 WordPress 網站的使用者停用 WP REST API。
評價
4.8
版本
2.6.7
活躍安裝總數
30K
最近更新:
Jan 29, 2026

Does one thing: Completely disables the WordPress REST API for visitors who are not logged into WordPress. No configuration required.

Important: This plugin completely disables the WP REST API for visitors who are NOT logged in to WordPress. So not recommended if your site needs the WP REST API for any non-logged users.

👉 The fast, simple way to prevent abuse of your site’s REST/JSON API 👉 Protects your site’s REST data from all non-logged users and bots 👉 Uses only 4KB of code, so super lightweight, fast, and effective

外掛特色

  • 為未登入的使用者停用 REST/JSON
  • 為全部使用者停用 HTTP 回應中的 REST 標頭
  • 為全部使用者停用 HTML 標頭中的 REST 連結
  • 完全隨裝即用,設定後不需後續管理

How does it work?

This plugin completely disables the WP REST API unless the user is logged into WordPress.

  • 對已登入的使用者來說,WP REST API 會正常執行
  • 對未登入/以登出的使用者來說,WP REST API 會是停用狀態

至於已登出/未登入的使用者產生 JSON/REST 要求後,他們會收到以下訊息:

rest_login_required: REST API restricted to authenticated users.

這個訊息可透過篩選器勾點 disable_wp_rest_api_error 進行自訂,請參考這篇文章的範例了解如何使用這個篩選器勾點。

隱私權

這個外掛不會收集或儲存任何使用者資料。它不會設定任何 Cookie,也不會連線至任何第三方位置,因此它不會透過任何方式侵犯使用者隱私。相反的,這個外掛可以改善使用者隱私,因為它可以保護潛在的敏感資訊不會透過 TEST API 顯示/存取。

Disable WP REST API 由具備 15 年 WordPress 開發者書籍作者經驗的 Jeff Starr 開發及維護。

支持這個外掛的開發工作

因為喜愛 WordPress 社群,因此我開發並維護這個免費外掛。如果想要支持外掛開發工作,請贊助開發工作或購買我撰寫的書籍:

也可以透過購買以下付費 WordPress 外掛支持外掛開發:

十分歡迎外部連結、轉推及按讚,謝謝大家 🙂

免費使用Business方案
目前已測試版本
WordPress 6.9.1
此外掛程式已可供下載,並可用於你 系統。