WordPress Invalid JSON Response: Diagnose REST, HTTPS and Permalink Failures

A WordPress invalid JSON response error can prevent you from publishing posts, updating pages, uploading content, or saving changes in the block editor.

You may see messages such as “Updating failed. The response is not a valid JSON response.” or “Publishing failed. The response is not a valid JSON response.”

This usually means the WordPress editor sent a request but received an unexpected response instead of the JSON data it expected.

Common causes include broken permalinks, REST API errors, incorrect WordPress URLs, HTTP/HTTPS conflicts, security plugins, firewall rules, redirects, caching, or server-side PHP errors.

QUICK ANSWER

If WordPress says the response is not a valid JSON response, first save your permalink settings again and test the REST API. Then verify your WordPress and Site URLs, check HTTPS, temporarily disable security and caching plugins, review redirects and firewall rules, clear all caches, and inspect browser and server errors. If /wp-json/ itself fails, fix the REST API problem before troubleshooting the editor.


What Does “The Response Is Not a Valid JSON Response” Mean?

The WordPress block editor communicates with your website in the background while you edit and save content.

It expects certain requests to return structured JSON data.

If the server instead returns something unexpected—such as an HTML error page, redirect, 403 response, 404 page, PHP warning, or 500 error—the editor cannot interpret the response correctly.

You may then see:

  • Updating failed.
  • Publishing failed.
  • The response is not a valid JSON response.
  • A post that refuses to save.
  • A page that cannot be published.
  • Media or block operations that stop working.

The error message describes the failed response, but it does not identify the exact cause.


1. Resave Your WordPress Permalinks

Broken rewrite rules are one of the simplest causes to test.

Go to:

Settings → Permalinks

Do not change the permalink structure.

Simply click:

Save Changes

This refreshes WordPress rewrite rules.

Then return to the editor and try updating or publishing the post again.

If the JSON error disappears, a permalink or rewrite-rule problem was likely preventing WordPress API URLs from resolving correctly.

If Permalinks Return 404 Errors

Test:

https://yourdomain.com/wp-json/

If this URL returns a 404 page instead of WordPress API data, your rewrite configuration needs further investigation.

On Apache hosting, check the WordPress .htaccess file.

Before editing it, create a backup copy.


2. Test the WordPress REST API

The block editor relies heavily on the WordPress REST API.

Open:

https://yourdomain.com/wp-json/

in a new browser tab.

A working WordPress REST API normally returns structured information.

If you instead receive:

  • 403 Forbidden,
  • 404 Not Found,
  • 500 Internal Server Error,
  • a redirect loop,
  • or another error page,

the invalid JSON message is probably a symptom of that deeper API problem.

Also go to:

Tools → Site Health

and check for REST API warnings.

If WordPress reports an API problem, see our WordPress REST API Error? 8 Fixes guide.


3. Check WordPress Address and Site Address

An incorrect site URL can cause the editor to send API requests to the wrong address.

Go to:

Settings → General

Check:

WordPress Address (URL)

and:

Site Address (URL)

For a normal HTTPS website, both should usually use the correct HTTPS domain.

Watch for differences such as:

  • http:// vs https://,
  • www.example.com vs example.com,
  • an old domain after migration,
  • or an incorrect subdirectory.

If WordPress attempts to save content through one URL while the website redirects to another, the API request can fail or return unexpected content.

Do not change these values casually on a live site if you are unsure about your domain configuration.


4. Fix HTTP and HTTPS Conflicts

Invalid JSON errors sometimes appear after switching a website from HTTP to HTTPS.

For example, the editor may load from:

https://example.com

while an API request is still being sent to:

http://example.com

This can trigger redirects, mixed-content problems, or blocked requests.

Check:

  • WordPress Address,
  • Site Address,
  • SSL certificate status,
  • Cloudflare SSL settings,
  • redirect rules,
  • and hard-coded HTTP URLs.

If your browser displays security warnings or the site is not consistently using HTTPS, see our WordPress Not Secure Warning? 8 Fixes guide.


5. Temporarily Disable Security and Firewall Plugins

A security plugin may block REST API requests used by the WordPress editor.

Temporarily test plugins that provide:

  • firewall protection,
  • REST API restrictions,
  • login protection,
  • IP blocking,
  • bot protection,
  • request filtering,
  • or application security.

Deactivate the most likely plugin and try publishing again.

If the editor immediately starts working, review the plugin settings instead of leaving the entire security system disabled.

If You Cannot Use wp-admin

Open your hosting file manager or FTP/SFTP.

Navigate to:

/wp-content/plugins/

Temporarily rename the suspected security plugin directory.

Then test WordPress again.

If API requests return a 403 response, see our WordPress 403 Forbidden Error? 8 Fixes guide.


6. Check Redirect Plugins, .htaccess, and Cloudflare Rules

A REST API request that is unexpectedly redirected may no longer return the JSON response expected by the editor.

Check for recent changes involving:

  • redirect plugins,
  • .htaccess,
  • Nginx rules,
  • Cloudflare redirect rules,
  • www-to-non-www redirects,
  • HTTP-to-HTTPS redirects,
  • maintenance rules,
  • and domain migration redirects.

Pay particular attention if the problem began after changing the domain or adding a new redirect.

You can test:

/wp-json/

and watch whether the browser immediately redirects it somewhere else.

If your website is caught in repeated redirects, see our WordPress Too Many Redirects? 8 Fixes guide.


7. Clear WordPress, Browser, Hosting, and CDN Caches

A cached API response, redirect, or old JavaScript file can make the JSON error continue after the underlying configuration has already been corrected.

Clear:

  • WordPress cache,
  • LiteSpeed Cache,
  • object cache,
  • hosting-level cache,
  • Cloudflare or CDN cache,
  • and browser cache.

Then open the editor in an incognito window.

Test a small change to an existing post.

If your optimization plugin delays, combines, or modifies WordPress admin JavaScript, temporarily disable those features while testing.

Do not keep repeatedly purging caches if the underlying REST request continues returning an actual error code.


8. Check Browser Console, Network Requests, and Server Logs

If the previous fixes do not identify the problem, inspect what the failed editor request actually returns.

In Chrome or Edge, press:

F12

Open:

Network

and:

Console

Then try publishing or updating the post again.

Look for requests that return:

  • 401,
  • 403,
  • 404,
  • 429,
  • 500,
  • 502,
  • 503,
  • or 504.

A failed request may point directly to:

/wp-json/

or a specific REST API endpoint.

Also check your hosting logs for:

  • PHP fatal errors,
  • PHP warnings printed into responses,
  • memory exhaustion,
  • ModSecurity blocks,
  • server errors,
  • and plugin exceptions.

If the response is an HTTP 500 error, see our WordPress 500 Internal Server Error? 8 Fixes guide.


Why Does WordPress Say “Updating Failed” but the Post Still Changes?

Sometimes the database update succeeds but the editor cannot correctly interpret the response afterward.

This can happen if the response contains:

  • unexpected PHP output,
  • a warning message,
  • HTML from a firewall,
  • a redirect,
  • or malformed API data.

Check the published page before repeatedly clicking Update.

If the change is already saved, repeated retries may only generate additional requests without addressing the underlying response problem.


Why Does the Error Happen Only on One Post?

If most posts save correctly but one particular post fails, investigate content specific to that post.

Possible causes include:

  • embedded HTML,
  • scripts,
  • unusual iframe code,
  • security rules triggered by specific text,
  • very large post content,
  • or a problematic block.

Try duplicating the content gradually into a new draft.

If the error appears after adding one specific block or code section, that content may be triggering a firewall or application rule.

Check ModSecurity and security-plugin logs at the same time.


Why Does the Error Appear After Moving WordPress?

Site migration is a common time for JSON response problems to appear.

Check:

  • WordPress Address,
  • Site Address,
  • old-domain references,
  • DNS records,
  • HTTPS configuration,
  • redirect rules,
  • REST API access,
  • and firewall settings on the new host.

A redirect or URL setting that worked on the old hosting environment may behave differently on the new server.

Also clear CDN and hosting caches after the migration.


Why Does WordPress Invalid JSON Happen After Installing a Security Plugin?

Security plugins sometimes restrict REST API traffic to reduce unwanted requests.

If the rules are too aggressive, they may also block legitimate editor requests made by logged-in administrators.

Check the security plugin for:

  • REST API blocking,
  • request filtering,
  • firewall rules,
  • IP restrictions,
  • and administrator exceptions.

Temporarily disabling the plugin is a diagnostic test, not the final security configuration.


Invalid JSON Response vs REST API Error

These problems are strongly related but not identical.

Invalid JSON response describes what the editor received when it expected valid JSON.

REST API error describes a broader failure involving WordPress REST API communication.

A REST API error can cause an invalid JSON response, but an invalid JSON response can also result from:

  • redirects,
  • PHP output,
  • firewalls,
  • authentication failures,
  • or server errors.

Check the actual HTTP response instead of assuming the editor itself is broken.


Invalid JSON Response vs 403 Forbidden

If the editor displays an invalid JSON error while the underlying request returns HTTP 403, the real problem is access blocking.

Investigate:

  • security plugins,
  • ModSecurity,
  • Cloudflare WAF,
  • hosting firewall rules,
  • and request filtering.

Fixing the 403 normally resolves the JSON symptom as well.


Can a Plugin Cause Invalid JSON Responses?

Yes.

A plugin can:

  • modify REST API behavior,
  • print PHP warnings into responses,
  • create redirects,
  • block API endpoints,
  • cause PHP fatal errors,
  • or conflict with the block editor.

If the issue began after a plugin update, temporarily deactivate that plugin and test publishing again.

If you cannot identify the plugin, temporarily test plugins in small groups.


Can a Theme Cause the JSON Error?

Yes, especially when a theme contains custom PHP or REST API modifications.

If plugin testing does not solve the problem, temporarily activate a standard lightweight theme.

If publishing immediately works, investigate:

  • functions.php,
  • custom API code,
  • child-theme functions,
  • and recently added snippets.

Do not permanently switch themes until the test confirms a theme-related problem.


Final Checklist

If WordPress says the response is not a valid JSON response, work through these steps:

  1. Resave WordPress permalinks.
  2. Test the REST API at /wp-json/.
  3. Verify WordPress Address and Site Address.
  4. Fix HTTP and HTTPS conflicts.
  5. Test security and firewall plugins.
  6. Review redirects, .htaccess, and CDN rules.
  7. Clear all caching layers.
  8. Inspect browser network requests and server logs.

The error is usually not caused by JSON itself. The editor is telling you that it expected JSON but received something else. Find that unexpected response—such as a redirect, 403, 404, 500, or PHP error—and fix the underlying request.

Leave a Comment