Linux 软件免费装
Banner图

Disable REST API for Real

开发者 samuelaguilera
更新时间 2019年11月15日 07:41
PHP版本: 4.7 及以上
WordPress版本: 5.3
版权: GPLv3
版权网址: 版权信息

标签

json api rest rest api wp-json

下载

1.0 2.0 2.1 2.1.1

详情介绍:

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. 必需条件 Features 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.

屏幕截图:

  • REST API option in Settings -> General page.
  • Jetpack's settings page confirming REST API is disabled.

升级注意事项:

2.0
  • Complete rewrite of the plugin to really disable REST API and removed support for WordPress 4.6.1 and older versions.

常见问题:

How can I test if the plugin is working?

Use your browser to go to http://example.com/wp-json (replace example.com with your site domain). Your site will return a 404 error. You can also check any regular page of your site to confirm the link to the REST API URL was removed from the HTTP header and from the HTML header. If you have set the plugin to "Logged In Only", no changes are made to the page headers, but you will receive the following response if you try the REST API without being logged in: {"code":"rest_not_logged_in","message":"External REST API requests not allowed for this site.","data":{"status":401}}

更新日志:

2.1.1 2.1 2.0 1.0