WordPress Connection Failing? Fix REST API Disabled, Wordfence, and HTTPS Errors

Published 1,949 words10 min readwordpress rest api disabled fix

WordPress connection failing? Fix a disabled REST API, Wordfence blocks, missing Application Passwords, and 401/403/404 errors on /wp-json fast.

Key takeaways

  • Test your REST API by visiting yoursite.com/wp-json before changing anything; JSON means it is on, an error or 404 tells you the fix.
  • Security plugins like Wordfence and Solid Security are the top cause; allowlist /wp-json instead of turning protection off.
  • Application Passwords are silently disabled on sites without HTTPS, so an SSL certificate is often the whole fix.
  • A 401 with the correct password usually means your host strips the Authorization header; add CGIPassAuth On to .htaccess.
  • A 403 is a firewall refusing the request; find the layer that said no and allowlist the API.
  • A 404 at /wp-json is a permalink problem; resave permalinks to rebuild the route.

You created an Application Password, pasted your site URL, and hit connect. Instead of a green checkmark, you got an error: "REST API disabled," "401 Unauthorized," "403 Forbidden," or "cannot connect to your site." This is the single most common reason a WordPress connection fails, and it is almost never a problem with the tool you are connecting. It is a setting on your own WordPress site that quietly blocks the connection.

These are the exact errors people hit when they connect PostSprout to WordPress so it can auto-publish articles. The good news: every one of them has a clear fix, and none of them need a developer. This guide walks through each failure as a symptom, a cause, and a fix, so you can find yours fast and get connected.

How do I know if my WordPress REST API is actually on?

Before you change anything, test the REST API in your browser. It takes ten seconds and tells you where the problem is.

Open a new browser tab and go to this address, swapping in your own domain:

  • yoursite.com/wp-json

What you see tells you a lot:

  • A wall of text (JSON) that starts with your site name and a list of "routes." Good. The REST API is on and reachable. Your problem is likely authentication (Application Passwords or a stripped header), covered further down.
  • A page that says "REST API disabled" or a short JSON error like rest_disabled or rest_login_required. A plugin or setting is switching the API off. See the security-plugin fixes below.
  • A 404 "Not Found" page. Your permalink rules are broken. Jump to the 404 fix below.

WordPress also has a built-in checker. Go to Tools > Site Health > Info > REST API in your dashboard. If it reports an error there, WordPress itself cannot reach its own API, which points to a plugin or server block.

Why does my WordPress REST API say it is disabled?

The REST API is the door any modern tool uses to talk to WordPress. When a connection fails, one of a handful of things is blocking that door. Here is the short map before we fix each one.

What you see Most likely cause Where to fix it
"REST API disabled" at /wp-json Security plugin or a "disable REST API" plugin Plugin settings, allowlist /wp-json
No "Application Passwords" section in your profile App Passwords turned off, or site on HTTP HTTPS, security plugin, or a filter
401 Unauthorized with a correct password Host strips the Authorization header .htaccess fix
403 Forbidden Firewall rule or security plugin Firewall allowlist / learning mode
404 Not Found at /wp-json Broken permalink rewrite rules Resave permalinks

How do I fix the REST API when a security plugin blocks it?

This is the number one cause. Security plugins ship rules that can turn off the REST API or block anyone who is not logged in, and a routine update can switch these on without warning.

Wordfence

Wordfence does not block the REST API by default, but its firewall can flag a connection as suspicious and stop it. Two things to check:

  1. Go to Wordfence > All Options > Firewall and look under the option groups for anything named "Disable WP API JSON." If it is checked, uncheck it.
  2. If the firewall is the culprit, set it to Learning Mode for a few minutes, run your connection again, then return the firewall to "Enabled and Protecting." Check Wordfence > Tools > Live Traffic and allowlist any blocked request to /wp-json.

Solid Security (formerly iThemes Security)

Solid Security has a REST API setting that can restrict access. Go to Security > Settings > Advanced > WordPress Tweaks, find the REST API section, and set it to Default Access. The "Restricted" setting is a common source of 401 errors on otherwise healthy sites.

"Disable REST API" plugins

Plugins with names like "Disable REST API," All In One WP Security, or some performance plugins have a single switch that turns the API off for anyone not logged in. If you installed one to harden your site, open its settings and either turn the block off or add /wp-json to its allowlist. If you are not sure which plugin is responsible, the fastest test is below.

Not sure which plugin is doing it?

Temporarily deactivate your security and optimization plugins one at a time, re-test yoursite.com/wp-json after each, and watch for the moment the API comes back. That tells you the exact plugin. Then re-enable it and adjust its setting rather than leaving it off.

Why are my Application Passwords disabled or missing?

To connect a tool, you create an Application Password under Users > Profile (scroll to the bottom). If that section is missing, WordPress has switched the feature off. Application Passwords are the safe, modern way to connect: they are a separate credential you can revoke any time without changing your real login.

Common reasons the section disappears:

  • Your site is on plain HTTP, not HTTPS. This is the most frequent cause, covered in the next section.
  • A security plugin turned the feature off. Look in your plugin settings for anything mentioning "Application Passwords" or "REST API authentication" and re-enable it.
  • Another Basic Auth layer is active. If your site or host puts an HTTP Basic Auth prompt in front of the whole site (a browser username and password popup before WordPress even loads), WordPress disables Application Passwords because the two conflict. Remove that extra layer, or ask your host to.
  • A code snippet or filter disables them. Some hardening guides add a line that turns Application Passwords off. Check your theme's functions.php and any code-snippet plugin for wp_is_application_passwords_available set to false, and remove it.

Why do Application Passwords need HTTPS, and how do I fix it?

WordPress silently disables Application Passwords on any site served over plain HTTP. This is on purpose. An Application Password travels in the request header, and on unencrypted HTTP anyone on the same network could read it. So WordPress checks for HTTPS first, and if it is not there, the feature is simply off, with no error to explain why.

How to fix it:

  1. Check Settings > General. If either WordPress Address or Site Address starts with http:// instead of https://, that is your problem.
  2. Install an SSL certificate if you do not have one. Most hosts offer a free certificate (Let's Encrypt) with a one-click enable in your hosting dashboard.
  3. Once the certificate is active, update both URLs in Settings > General to https:// and save. The Application Passwords section will reappear in your profile.

One note for developers only: WordPress does allow Application Passwords over HTTP on a true local environment (localhost). For any live site, HTTPS is the real fix, and it is worth having anyway.

Why do I get a 401 even when the password is correct?

This one is sneaky. You copied the Application Password exactly, HTTPS is on, the API responds at /wp-json, and you still get 401 Unauthorized. The usual cause is that your hosting server is stripping the Authorization header before it reaches WordPress.

WordPress reads your Application Password from the Authorization header on each request. Some Apache and LiteSpeed setups drop that header on the way in, so WordPress never sees your credentials and rejects the request as if the password were wrong.

The fix is to tell your server to pass the header through. Edit the .htaccess file in your WordPress root folder (or ask your host to). Add one of these, above the # BEGIN WordPress line:

The simplest option, which works on most modern hosts:

  • CGIPassAuth On

If that does not work, remove it and try the rewrite version instead:

  • RewriteEngine On
  • RewriteCond %{HTTP:Authorization} ^(.+)$
  • RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Save the file and test your connection again. If you are on managed WordPress hosting where you cannot edit .htaccess, open a support ticket and ask them to "pass the Authorization header through to PHP for REST API requests." They will know exactly what you mean. Some hosts strip the header at a level you cannot reach from .htaccess, so their support is the only path.

Why do I get a 403 Forbidden instead?

A 403 Forbidden is not the same as a disabled API. It means something actively refused the request. The API exists, but a gatekeeper said no. The gatekeeper is almost always a firewall: your security plugin, a web application firewall at your host, or a service like Cloudflare sitting in front of your site.

Work through these in order:

  1. Security plugin firewall. Same fix as above. Put Wordfence into Learning Mode, run the connection, then allowlist the blocked request in Live Traffic.
  2. Host-level firewall. Many managed hosts run their own firewall. Ask support whether requests to /wp-json are being blocked, and ask them to allowlist your connecting tool.
  3. Cloudflare or a CDN. If you use Cloudflare, check its firewall and bot-fighting rules for anything blocking POST requests to /wp-json, and add an exception.

The pattern is always the same: find the layer that said no, then allowlist the API rather than turning the whole protection off.

What if I get a 404 at /wp-json?

A 404 "Not Found" at /wp-json means the API route does not exist as far as your server is concerned. This is almost always a permalink problem, not a security block.

The REST API rides on the same rewrite rules that make your post URLs pretty. If those rules are stale or your permalinks are set to "Plain," the /wp-json route never gets registered.

The fix takes two clicks:

  1. Go to Settings > Permalinks.
  2. Make sure the structure is set to anything other than "Plain" (Post name is a good default), then click Save Changes. You do not need to change anything. Saving alone rewrites the rules and re-registers the API route.

Re-test yoursite.com/wp-json. If it still 404s, your .htaccess may be corrupted. On Apache or LiteSpeed, rename .htaccess to .htaccess-old using your host's file manager, then save permalinks again to generate a clean file. Also confirm mod_rewrite is enabled, which your host can check.

How do I connect WordPress cleanly the first time?

If you are setting this up from scratch rather than debugging, doing it in the right order avoids every error above. Our step-by-step walkthrough on how to connect WordPress with the REST API and Application Passwords covers the whole flow, and if you are still choosing where your blog lives, how to set up a blog on WordPress gets the foundation right first.

Still stuck? Run this quick checklist

Work down this list in order. Most connections are fixed by step three.

  1. Visit yoursite.com/wp-json. JSON means the API is on; an error or 404 tells you which fix to use.
  2. Confirm your site is on HTTPS (Settings > General). No HTTPS means no Application Passwords.
  3. Deactivate security and optimization plugins one at a time, re-testing after each, and allowlist /wp-json in the one that was blocking it.
  4. Make sure the Application Passwords section appears under Users > Profile, and create a fresh password.
  5. For a stubborn 401, add CGIPassAuth On to .htaccess, or ask your host to pass the Authorization header through.
  6. For a 404, resave your permalinks.

These are the exact checks PostSprout runs into when it connects to a store's WordPress site to auto-publish daily SEO articles. Once the connection is clean, PostSprout writes and publishes to your blog on its own, so you never have to touch the REST API again. If you want hands-off publishing to WordPress or Shopify, start with PostSprout and let it handle the posting while you run your store.

FAQ

How do I check if my WordPress REST API is enabled?+

Visit yoursite.com/wp-json in your browser. If you see a wall of JSON text with your site name and a list of routes, the API is on. If you see a 'REST API disabled' message or a 404, it is blocked, and the cause is usually a security plugin or a broken permalink rule.

Why are Application Passwords missing from my WordPress profile?+

The most common reason is that your site runs on plain HTTP. WordPress disables Application Passwords on any non-HTTPS site for security. A security plugin, a conflicting Basic Auth layer, or a code snippet can also turn the feature off. Enable HTTPS and check your security plugin settings to bring the section back.

Why do Application Passwords require HTTPS?+

An Application Password travels in the request header, and on unencrypted HTTP anyone on the same network could read it. WordPress checks for HTTPS first and switches the feature off if it is missing, with no error message. Installing an SSL certificate and updating your site URLs to https:// fixes it.

Why do I get a 401 error even with the correct Application Password?+

Your hosting server is likely stripping the Authorization header before it reaches WordPress, so WordPress never sees your credentials. Add 'CGIPassAuth On' to your .htaccess file, or ask your host to pass the Authorization header through to PHP for REST API requests.

Does Wordfence block the WordPress REST API?+

Wordfence does not block the REST API by default, but its firewall can flag a connection and stop it, and an update can enable a 'Disable WP API JSON' option. Put the firewall in Learning Mode, run your connection, then allowlist the blocked request in Live Traffic before switching protection back on.

How do I fix a 404 error on /wp-json?+

A 404 means the API route is not registered, which is a permalink problem. Go to Settings > Permalinks, set the structure to anything other than Plain, and click Save Changes. This rebuilds the rewrite rules and re-registers the API route. If it persists, regenerate a clean .htaccess file.

The playbook

Get the AEO playbook we use.

The playbook first, then a few short emails to help you publish your first great article, then just the occasional update. No spam, and you can unsubscribe anytime.