30,000+
April 22, 2026
June 6, 2018
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
🛠️ Pro version available! Check out REST Pro Tools »
How does it work?
This plugin completely disables the WP REST API unless the user is logged into WordPress.
What happens if logged-out visitor makes a JSON/REST request? They will get only a simple message:
rest_login_required: REST API restricted to authenticated users.
This message may customized via the filter hook, disable_wp_rest_api_error. Check out this post for an example of how to do it.
🛠️ Check out the Pro version, REST Pro Tools, loaded with many awesome features:
The free version does only one thing: disables REST API for unauthenticated users. The PRO version can do that and much more! Take full control of the REST API with REST Pro Tools »
This plugin does not collect or store any user data. It does not set any cookies, and it does not connect to any third-party locations. Thus, this plugin does not affect user privacy in any way. If anything it improves user privacy, as it protects potentially sensitive information from being displayed/accessed via REST API.
Disable WP REST API is developed and maintained by Jeff Starr, 15-year WordPress developer and book author.
I develop and maintain this free plugin with love for the WordPress community. To show support, you can make a donation or purchase one of my books:
And/or purchase one of my premium WordPress plugins:
Links, tweets and likes also appreciated. Thank you! 🙂
How to Install
More info on installing WP plugins
Testing
To test that the plugin is working, log out of WordPress and then request https://example.com/wp-json/ in a browser. See FAQs for more infos.
Pro Version
Need more control of the WP REST API? Check out the Pro version »
Like the plugin?
If you like Disable WP REST API, please take a moment to give a 5-star rating. It helps to keep development and support going strong. Thank you!
Uninstalling
To uninstall/remove the plugin, visit the Plugins screen, deactivate and delete the plugin. This plugin makes no changes to the WP database.
Technically this plugin disables REST API only for visitors who are not logged into WordPress. With that in mind, here are some good reasons why someone would want to disable REST API for non-logged users:
I’m sure there are other valid reasons, but you get the idea 🙂
When the user is logged in to WordPress, the normal REST API data will be displayed. When the user is not logged in, this is the default message:
{"code":"rest_login_required","message":"REST API restricted to authenticated users.","data":{"status":401}}
Testing is easy:
https://example.com/wp-json/If you see the following message, REST is disabled:
“rest_login_required: REST API restricted to authenticated users.”
Then if you log back in and make a new request for https://example.com/wp-json/, you will see that REST is working normally.
Yes. If the user is NOT logged in, this plugin disables ALL endpoints that are registered with the WP REST API. Otherwise, if the user IS logged in, then this plugin does not block anything.
Yes. It works the same regardless of which editor (Classic or Block) you are using.
By default the plugin displays a message for unauthenticated users: “REST API restricted to authenticated users.” To customize that message to whatever you want, add the following code via functions.php or simple custom plugin:
function disable_wp_rest_api_error_custom($message) {
return 'Customize your message here.'; // change this to whatever you want
}
add_filter('disable_wp_rest_api_error', 'disable_wp_rest_api_error_custom');
As explained in this thread, the plugin Contact Form 7 requires REST API access in order for the contact form to work. To allow for this, follow this guide.
Send any questions or feedback via my contact form
If you like Disable WP REST API, please take a moment to give a 5-star rating. It helps to keep development and support going strong. Thank you!
🛠️ Pro version now available! Get granular control over the REST API with REST Pro Tools »
Full changelog @ https://plugin-planet.com/wp/changelog/disable-wp-rest-api.txt
| Version | Download | Type |
|---|---|---|
| 2.6.8 | Download | Stable |
| 2.6.7 | Download | Stable |
| 2.6.6 | Download | Stable |
| 2.6.5 | Download | Stable |
| 2.6.4 | Download | Stable |
| 2.6.3 | Download | Stable |
| 2.6.2 | Download | Stable |
| 2.6.1 | Download | Stable |
| 2.6 | Download | Stable |
| 2.5.1 | Download | Stable |
| 2.5 | Download | Stable |
| 2.4.1 | Download | Stable |
| 2.4 | Download | Stable |
| 2.3 | Download | Stable |
| 2.2 | Download | Stable |
| 2.1 | Download | Stable |
| 2.0 | Download | Stable |
| 1.9 | Download | Stable |
| 1.8 | Download | Stable |
| 1.7 | Download | Stable |
| 1.6 | Download | Stable |
| 1.5 | Download | Stable |
| 1.4 | Download | Stable |
| 1.3 | Download | Stable |
| 1.2 | Download | Stable |
| 1.1 | Download | Stable |
| 1.0 | Download | Stable |
| Development | Download | Trunk |