Type to search.

#964 by installs

Disable WP REST API

by Jeff StarrVersion 2.6.9

Disables the WP REST API for visitors not logged into WordPress.

Active installs
30,000+
#964 of 1,000
Downloads, all time
443.4K
443,430
Downloads, 30 days
7.2K
1.7K in the last 7
Rating
4.8 / 5
36 reviews
Last updated
3 months ago
Aug 10, 2026
Version
2.6.9
29 releases

Upkeep and compatibility

Last updatedAugust 10, 2026Updated in the last 3 months
Tested up toWordPress 7.1.4Covers WordPress 7.1.4, the current release
Needs WordPress4.7 or newer
Needs PHP5.6.20 or newer
First publishedJune 6, 2018
Support, last two months1 of 1 threads resolved (100%)

Reviews

4.8 / 5 from 36 reviews

Reviews by star rating
5 stars34
4 stars0
3 stars1
2 stars0
1 star1

Downloads, last 30 days

Low 95 a dayHigh 577 a day

What the author says it does

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

  • Disable REST/JSON for visitors (not logged in)
  • Disables REST header in HTTP response for all users
  • Disables REST links in HTML head for all users
  • 100% plug-and-play, set-it-and-forget solution

How does it work?

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

  • For logged-in (authenticated) users, WP REST API works normally
  • For logged-out (unauthenticated) users, WP REST API is disabled

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.

Questions the author answers

Why would anyone want to disable the REST API?

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:

  • The REST API may not be needed for non-logged users
  • Disabling the REST API conserves server resources
  • Disabling the REST API minimizes potential attack vectors
What is the default access-denied message?

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}}

How do I test that REST is disabled?

Testing is easy:

  • Log out of WordPress
  • Using a browser, request 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.

Does it disable REST functionality added by other plugins?

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.

Does this work with Gutenberg/Block Editor?

Yes. It works the same regardless of which editor (Classic or Block) you are using.

How to customize the error message?

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

Latest changelog entry

2.6.9

  • Tests on WordPress 7.1

Tagged

Plugins that share its tags

#513 by installs

Disable REST API

by Dave McHale

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

#577 by installs

Make Connector

by Make

Make Connector. Make lets you design, build, and automate by connecting with WordPress in just a few clicks.

Installs
70,000+
Rating
2.7 (25)
Updated
9 months ago

#25 by installs

Classic Widgets

by Tonya Mork

Enables the previous "classic" widgets settings screens in Appearance - Widgets and the Customizer. Disables the block editor from managing widgets.

Installs
2+ million
Rating
4.9 (272)
Updated
11 months ago

#154 by installs

WooCommerce Legacy REST API

by Automattic

The WooCommerce Legacy REST API, which is now part of WooCommerce itself but will be removed in WooCommerce 9.0.

Installs
400,000+
Rating
1.5 (29)
Updated
17 days ago

#202 by installs

WP Consent API

by Rogier Lankhorst

Simple Consent API to read and register the current consent category.

Installs
200,000+
Rating
5.0 (2)
Updated
16 days ago

#394 by installs

Disable Comments

by rbplugins

Disable Comments - easy tool to disable comments for your blog posts, and pages. Admin can disable comments in just a few clicks.

Installs
100,000+
Rating
3.8 (25)
Updated
36 days ago

Where this page's numbers come from

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.