#513 by installs
Disable REST API
Disable the use of the REST API on your website to site users. Now with User Role support!
- Installs
- 80,000+
- Rating
- 4.8 (38)
- Updated
- 3 years ago
Disables the WP REST API for visitors not logged into WordPress.
| Last updated | August 10, 2026Updated in the last 3 months |
|---|---|
| Tested up to | WordPress 7.1.4Covers WordPress 7.1.4, the current release |
| Needs WordPress | 4.7 or newer |
| Needs PHP | 5.6.20 or newer |
| First published | June 6, 2018 |
| Support, last two months | 1 of 1 threads resolved (100%) |
4.8 / 5 from 36 reviews
| 5 stars | 34 |
|---|---|
| 4 stars | 0 |
| 3 stars | 1 |
| 2 stars | 0 |
| 1 star | 1 |
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 »
Features
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.
Pro Version
The opening of the plugin's own description. The full text, installation notes and changelog are on its WordPress.org page.
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:
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:
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
#513 by installs
Disable the use of the REST API on your website to site users. Now with User Role support!
#577 by installs
Make Connector. Make lets you design, build, and automate by connecting with WordPress in just a few clicks.
#25 by installs
Enables the previous "classic" widgets settings screens in Appearance - Widgets and the Customizer. Disables the block editor from managing widgets.
#154 by installs
The WooCommerce Legacy REST API, which is now part of WooCommerce itself but will be removed in WooCommerce 9.0.
#202 by installs
Simple Consent API to read and register the current consent category.
#394 by installs
Disable Comments - easy tool to disable comments for your blog posts, and pages. Admin can disable comments in just a few clicks.
Read from the WordPress.org plugin API on , when WordPress 7.1.4 was the current release. WordPress.org rounds active installs into buckets. These are the directory's figures, not my verdict, and I haven't tested this plugin. The author takes donations at their donate page.