Skip to content
TatiCreative
All articles

· 7 min read · Mert Tati

Is the WordPress REST API Secure? REST API Security Without Disabling It

Is the WordPress REST API secure? Lock down user enumeration and application passwords without disabling it or breaking Gutenberg and WooCommerce.

Short answer: the WordPress REST API itself is secure and you shouldn’t disable it; the block editor (Gutenberg), WooCommerce and many form plugins depend on it. The real risks aren’t in the API’s existence but in the details: it hands a user list to logged-out visitors, unused application passwords stay enabled, and plugins add endpoints with missing permission checks. The right approach is to keep the REST API on, close those three gaps, and make sure login attempts coming through REST are counted too.

Railway switch splitting into multiple tracks, an API connecting systems

What is the WordPress REST API?

The REST API is the interface that gives access to WordPress data (posts, pages, users, products, orders) in JSON format at yourdomain.com/wp-json/. WordPress’s own admin screens, JavaScript in the browser and external applications all use it. Each address, called an endpoint, does a specific job: /wp/v2/posts serves posts, /wp/v2/users serves users, and /wc/v3/... serves WooCommerce data.

Every endpoint has its own permission check. Reading published posts is open to everyone, since that information is already visible on your site. Creating a post, viewing orders or changing settings, on the other hand, requires a logged-in user with the right permissions.

Why disabling the REST API is a bad idea

The common advice online to “disable the REST API completely” breaks things on most sites today:

  • Block editor (Gutenberg): saving posts, adding media and most blocks rely on the REST API. Turn it off and the editor won’t load or can’t save.
  • WooCommerce: the block-based cart and checkout pages use the Store API, and the admin dashboard and mobile app use the REST API.
  • Form and page builder plugins: many plugins, such as Contact Form 7, submit forms over REST.
  • Integrations: marketplace, ERP, accounting and shipping connections usually send and receive data via the REST API.
  • Site Health and some background checks also depend on REST.

That’s why you need targeted measures instead of a blanket “disable REST” switch. The same logic applies to hiding your login page: a proper solution that hides wp-login.php shouldn’t touch the REST API. We cover this in detail in our post on changing the WordPress login URL.

The real risks in the WordPress REST API

  • User list: /wp-json/wp/v2/users gives logged-out visitors the users who have published content, along with their slugs. This is the first step in password-guessing attacks; details in our post on hiding WordPress usernames.
  • Application passwords: since WordPress 5.6, every user can create application passwords that log in to the REST API independently of their main password. By design, these bypass 2FA. If you don’t use them, leaving them enabled is an unnecessary way in; if you do, your login attempt limit needs to count failed attempts coming through this route too.
  • Plugin endpoints: plugins add their own REST endpoints, and the plugin developer writes the permission checks. An endpoint with a missing or faulty check can let someone who isn’t logged in read or change data.
  • Excess data: some endpoints may return more fields than necessary (emails, order details, internal IDs). Custom-built endpoints should return only the fields that are needed.
  • Load: heavy endpoints like search and filters can be hammered by bots, and a site without rate limiting can slow down as a result.

REST API security checklist

  • The REST API is on; the editor, WooCommerce and forms all work.
  • /wp-json/wp/v2/users is closed to logged-out visitors and open to logged-in users.
  • Application passwords are disabled if unused; if used, each integration has its own named password and unused ones have been revoked.
  • Integration accounts are separate users with only the permissions they need, not administrators.
  • Failed attempts with application passwords also count toward the login attempt limit.
  • Plugins are up to date; unused plugins have been deleted (deleted, not just deactivated).
  • Every custom-built endpoint has a permission_callback defined and returns only the necessary fields.
  • The site runs over HTTPS; application passwords and cookies are never sent over an unencrypted connection.

Tracking plugin vulnerabilities one by one, filtering malicious requests at the content level (WAF) and backups are separate jobs; for those you need vulnerability alert services, a firewall at the server or CDN level, and a regular backup solution. If you’re building a web application with its own endpoints, getting the permission and data design right from the start is the cheapest path; in our SaaS and web app development projects, we treat it as the first step of the design.

How to use application passwords safely for integrations

Key card handed over at a hotel reception, application passwords

If you need application passwords for a marketplace, ERP or accounting connection, manage them with discipline instead of turning the feature off:

  • Create a separate WordPress user for each integration and give it only the role it needs. A shipping integration doesn’t need to be an administrator; in WooCommerce, Shop Manager or an even narrower role is usually enough.
  • Give each application password a clear name (for example, “ERP sync”); the profile screen shows its last used date and IP, so you can easily revoke the ones that are no longer in use.
  • After entering the password into the integration’s settings, don’t store it anywhere else in plain text; when you change integrations, revoke the old password.
  • When someone leaves the team or you stop working with a service provider, revoke their application passwords and close their account.
  • WooCommerce’s own REST API keys (consumer key/secret) should be managed the same way: if read access is enough, don’t issue a read/write key.

Doing it with one plugin: REST API security with Hushfort

The Hushfort WordPress security plugin doesn’t disable the REST API; it takes a targeted approach to the WordPress side of the risks above:

  • The REST /wp/v2/users, single-user and /users/me routes are closed to logged-out visitors. Logged-in users are exempt, so Gutenberg’s author selector, WooCommerce admin and plugins keep working.
  • Application passwords can optionally be disabled from the Surface Hardening module. The setting is left on by default, because disabling it means mobile apps, external integrations and WordPress 7.1 Connectors can no longer log in with application passwords; the screen states this consequence clearly.
  • Failed REST attempts with application passwords are recorded in the Limit Login module’s lockout counter; normally, these attempts bypass the login page’s counter. The Source column in History shows that an attempt came through REST.
  • The Hide Login module hides wp-login.php and wp-admin without touching the REST API, admin-ajax.php or WP-Cron.
  • Surface Scan sends real requests to your site, shows by name which usernames the REST user list exposes, and reports whether application passwords are enabled.
  • Load Protection cuts off request floods with a 429 using a per-minute IP budget that charges more points for expensive requests; WooCommerce checkout and payment provider callbacks are never blocked under any circumstances.

Other posts in this series: disabling XML-RPC in WordPress and WordPress two-factor authentication (2FA). If you’d like to leave your site’s maintenance and updates to our Izmir-based team, take a look at our software and hosting service.

Frequently asked questions

Can I just restrict the REST API to logged-in users? It’s not recommended. WooCommerce’s block-based cart and checkout pages, along with many form plugins, make REST calls on behalf of logged-out visitors. Instead of shutting it down entirely, close sensitive routes like the user list in a targeted way.

Is a publicly accessible wp-json a vulnerability? No. Reading published content just returns information that’s already visible on your site, as JSON. A vulnerability is an endpoint with a missing permission check that exposes or modifies private data.

What breaks if I disable application passwords? Mobile apps, automation tools and external integrations that connect with an application password. Normal login, the editor and WooCommerce customer login aren’t affected. If you use an integration, leave them on and make sure failed attempts are counted.

How can I tell whether a plugin’s REST endpoint is secure? Keep the plugin updated and follow security advisories. For plugins you’ve built yourself or had built, confirm through code review that every endpoint has a permission_callback defined.

Summary: The WordPress REST API is secure and shouldn’t be disabled. Close the user list to logged-out visitors, disable application passwords if you don’t use them, count failed attempts coming through REST, keep plugins updated, and never skip permission checks on your own endpoints.

More articles

Request a call

Describe your project in 60 seconds.

Fill in the short pre-form; we'll match you with the right person and reply within 24 hours.

A native English-speaking Project Lead from our team runs your project with you.

01 / 04

Which areas do you need help with?

  • UI/UX & Product Development
  • AI Solutions
  • Graphic & Brand Design
  • Software & Hosting
  • Studio & Production
  • Social Media
  • Digital Marketing
  • Digital Transformation
  • Industrial IoT (IIoT)
Average response time< 24 hours