Docs

Protect the REST API

4 min readUpdated November 19, 2026

The WordPress REST API is a set of web addresses (under /wp-json/) that apps, the block editor and other plugins use to talk to your site. It’s also something attackers poke at, for two reasons: it can reveal your usernames, and it accepts logins through “Application Passwords”.

Shield has three switches that deal with this. They’re in the REST API Protection section.

A settings menu for REST API Protection with three toggle options. Each row features a description of a security feature, including blocking user enumeration, protecting authentication, and disabling application passwords, with a toggle switch set to the off position.

Where to find it#

Go to Settings → Login Shield → General tab and scroll to REST API Protection. Change the switches and click Save general settings.

All three are off by default in a fresh install. The Security Checklist (see “The security checklist”) flags Block user enumeration and Disable Application Passwords when they are off. It has no check for Protect REST authentication.

Block user enumeration#

What it does. By default, anyone can open yoursite.com/wp-json/wp/v2/users and get a list of your site’s authors, including their usernames. Attackers use that list to know which usernames to guess passwords for. This switch makes that address, and the single-user address /wp-json/wp/v2/users/{id}, available only to logged-in users who are allowed to list users (administrators, by default).

What visitors see. A logged-out visitor, or a logged-in user without permission, gets WordPress’s normal “not allowed” error instead of the list.

What it doesn’t cover. It only protects those two REST addresses. Usernames can leak in other ways: author archive pages (?author=1), the author name shown in posts, and login error messages. Shield’s login error messages are already made vague so they don’t reveal whether a username exists. See “How lockout works”.

Side effects to know about.

  • Some themes, plugins and apps read your public author list through the REST API. If one of them stops showing authors, this switch is the reason.
  • The block editor loads the author picker from this same address. If you have users who can edit posts but can’t list users (editors, for example), their author dropdown may come up empty. Administrators aren’t affected.

Protect REST authentication#

What it does. Apps can log in to the REST API without a browser, by sending a username and an Application Password in a request header. Attackers can try to guess these just as they try to guess passwords on the login page. This switch applies Shield’s IP rules to those requests.

With it on, when a request carries login credentials and the visitor isn’t already logged in:

  • An IP on your blocklist is refused with a 403 error (“Your IP address has been blocked.”).
  • An IP that is locked out is refused with a 429 error (“Too many failed login attempts. Please try again later.”).
  • A request using a honeypot username locks that IP out and returns a 403 error (“Access temporarily restricted.”). See “Honeypot usernames”.
  • Failed attempts are counted using your normal limits (Lockout tab) and written to the event log with the note “REST API”. Too many failures lock the IP out.

Requests from whitelisted IPs, and from users who are already logged in, are never blocked.

Who is affected. Only requests that send credentials in a header. Normal visitors and the logged-in editor are unaffected.

Disable Application Passwords#

What it does. Application Passwords are a WordPress feature that lets you create a separate password for an app or integration, so the app never needs your real password. This switch turns the whole feature off. The “Application Passwords” section disappears from user profiles, and no app can log in that way.

Turn it on if nothing you use connects to your site through the REST API with a password. That includes mobile apps, automation tools, Zapier-style connectors, and remote-management tools. If you’re not sure, leave it off, or check your users’ profile pages for existing Application Passwords first. Turning it on will break any integration that uses one.

Leave it off if you use tools that sign in this way. In that case, turn on Protect REST authentication instead.

Which to turn on#

Your situationSuggested settings
No apps or integrations use the REST API with a passwordBlock user enumeration, Protect REST authentication, Disable Application Passwords
You use integrations that sign in with an Application PasswordBlock user enumeration, Protect REST authentication; leave Disable Application Passwords off
Editors need the author picker in the editorTest with an editor account after turning on Block user enumeration
  • Disable XML-RPC. The older remote-access method has its own switch. See “Disable XML-RPC”.
  • Restrict roles to IP addresses. This also covers REST requests from logged-in users of certain roles. See “Restrict roles to IP addresses”.
  • Passkey, magic link and 2FA endpoints. Shield’s own REST addresses (under /wp-json/nahnls/v1/) have their own protections, described under “Passkeys” and “REST API”.

Was this helpful?

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only