All guides
Troubleshooting guide Editor & Publishing

Updating Failed: The Response Is Not a Valid JSON Response (WordPress Fix)

You hit Update, the block editor turns red, and WordPress tells you the response is not a valid JSON response. The post is usually fine. What is broken is the REST API request between the editor and your server. Here is the order I work through it, from permalinks to SSL to the mod_security rule your host will not mention.

WPRescue Editorial Team Published August 8, 2026 Last reviewed August 8, 2026 12 min read Step-by-step walkthrough
Reviewed and tested by the WPRescue team on a real WordPress install before publishing. How we test fixes
WordPress editor showing the Updating failed, response is not a valid JSON response error

What's Happening

You click Publish or Update in the block editor and a red bar appears at the top of the screen: 'Updating failed. The response is not a valid JSON response.' Sometimes it says 'Publishing failed' instead. The content is still in the editor, nothing is lost yet, but nothing saves either. The block editor talks to your site through the WordPress REST API at /wp-json/. When that request comes back as anything other than clean JSON, an HTML error page, a 403 from a firewall, a redirect, or an empty body, the editor cannot parse it and shows this message. The error text describes the symptom, not the cause, which is why generic advice rarely fixes it.

This error has a reputation for being hard because the message tells you nothing useful. 'The response is not a valid JSON response' is the editor's way of saying it asked the server a question and got gibberish back. The fix is never about the JSON. It is about finding which layer between the browser and PHP is returning something that is not JSON.

I keep a fixed order for this one because guessing wastes an hour and the checklist takes fifteen minutes. Permalinks first, then site URLs, then SSL, then plugins, then the server firewall. In roughly seven out of ten cases I never get past the first two steps.

Step 1: Find out whether the REST API works at all

Before changing anything, open a new browser tab and go to https://yoursite.com/wp-json/. A healthy install returns a dense block of JSON starting with a name, description, and a long routes object. That means the API is reachable and routing correctly.

If you get a 404 page, the rewrite rules are broken and Step 2 will most likely fix it. If you get a 403 or a security challenge page, a firewall is blocking the API and you can skip straight to Step 5. If the page is blank, PHP is fatally erroring before it can output anything and you should read your error log first.

Tools > Site Health > Status runs the same check inside WordPress and shows the HTTP status code it received. Between the browser test and Site Health you know within a minute which half of the checklist applies to you.

Step 3: Make the site URLs match reality

Open Settings > General and read both WordPress Address (URL) and Site Address (URL) carefully. They must match the exact address in your browser bar: same protocol, same www or non-www, no trailing slash. A mismatch means the editor requests the API on one host and the server redirects it to another. A redirect returns HTML headers, the editor sees no JSON, and you get the error.

If those fields are greyed out, they are hardcoded in wp-config.php with WP_HOME and WP_SITEURL. Edit them there instead. Change one line at a time and reload the editor between changes so you know which edit did what.

phpMixing http and https here is one of the quiet causes of REST API failures.
// wp-config.php: keep these identical to the URL you type in the browser
define('WP_HOME',    'https://example.com');
define('WP_SITEURL', 'https://example.com');

Step 4: Rule out SSL and mixed content

A half-installed certificate produces this error reliably. The admin loads over https, the REST endpoint resolves to http, and the browser refuses the request as mixed content. Nothing appears in your PHP log because the request never reaches PHP.

Open your browser's developer console on the editor screen and look at the Network tab while you hit Update. Find the request to wp-json/wp/v2/posts. Read its status code and its response body. A 301 or 302 means a redirect is in the way. A 403 means something blocked it. A 200 that contains HTML means a plugin or theme printed output before the JSON. Each of those points at a different fix, and the Network tab is the only place that tells you which one you have.

Step 5: Find the plugin or firewall that is blocking POST requests

If /wp-json/ loads fine in a browser but saving still fails, the block is specific to POST requests. That is the signature of a security plugin or a server-level web application firewall, because reading the API is harmless and writing to it is what they are configured to inspect.

Deactivate security plugins one at a time: Wordfence, Solid Security, All In One WP Security, Sucuri, NinjaFirewall. Retry the update after each deactivation rather than turning them all off at once, otherwise you learn nothing about which one is responsible. If a plugin is the cause, do not leave it off. Find its firewall log, locate the blocked request, and add a rule exception for the REST route.

Also check for plugins that print output on init. Any stray whitespace, notice, or echo before the REST response corrupts the JSON body. Switching to a default theme for two minutes rules the theme's functions.php in or out of that list.

Step 6: The mod_security rule your host will not mention

This is the case that sends people in circles for days. Everything looks correct, /wp-json/ loads, no plugin is at fault, and saving still fails on certain posts. What is happening is a server-level mod_security rule inspecting the POST body and blocking requests that contain patterns it treats as attacks: script tags, iframes, SQL keywords, long base64 strings, or shortcodes with unusual characters.

You cannot see those blocks from inside WordPress. Open a ticket with your host, give them the exact time you triggered the error and the URL of the post, and ask them to check the mod_security audit log for a blocked POST to /wp-json/wp/v2/posts. They will come back with a rule ID. Ask them to whitelist that rule for your admin paths, not to disable mod_security entirely.

  • Symptom: only some posts fail, usually ones with embeds, code blocks, or raw HTML
  • Symptom: the same content saves fine after you delete one specific block
  • Symptom: /wp-json/ loads perfectly in a browser but POST requests fail
  • Evidence to request: mod_security audit log entry with rule ID and timestamp
  • Correct fix: a targeted rule exception, never a blanket mod_security shutdown

A publishing deadline that came down to one firewall rule

A recipe site on a shared host could publish short posts all day but every long recipe with an embedded YouTube video failed with this error. The owner had already reinstalled WordPress core, disabled every plugin, and switched themes twice. None of it helped because none of it touched the actual cause.

The Network tab told the real story in about thirty seconds: the POST to wp-json/wp/v2/posts returned a 403 with an HTML page from the host's firewall. The host confirmed a mod_security rule was matching the iframe in the embed. They whitelisted the rule for logged-in admin requests and every stuck recipe published on the first try.

The lesson I keep relearning: read the failing request before changing anything. The error message describes a parsing failure, but the Network tab tells you the status code, and the status code tells you which of the six causes you are dealing with.

Final checklist

Work these in order and stop at the first one that fixes it. Skipping ahead is how a fifteen-minute job becomes an afternoon.

  • https://yoursite.com/wp-json/ returns JSON, not a 404 or a block page
  • Settings > Permalinks has been re-saved once since the error started
  • Settings > General shows the exact URL you type in the browser, protocol and www included
  • The Network tab shows the status code of the failing wp-json request (200, 301, 403, or 500)
  • Security plugins have been tested one at a time, not all disabled at once
  • A default theme has been tried briefly to rule out output from functions.php
  • Your host has checked the mod_security log if everything above passes
  • Classic Editor, if installed, was a temporary workaround and has been removed after the real fix

Complete Fix Checklist

  1. 1Open Tools > Site Health > Info and check the REST API section, a failing REST API is reported there before you touch anything else.
  2. 2Load https://yoursite.com/wp-json/ directly in a browser tab, you should see a wall of JSON, not a 404 page or a security block.
  3. 3Go to Settings > Permalinks and click Save Changes without editing anything, this rewrites .htaccess and fixes the most common cause.
  4. 4Confirm Settings > General has the correct WordPress Address and Site Address, matching protocol and www exactly.
  5. 5Check for mixed content or a partially installed SSL certificate, an https page calling an http REST endpoint gets blocked by the browser.
  6. 6Deactivate security and firewall plugins one at a time (Wordfence, iThemes, All In One WP Security) and retry the update after each.
  7. 7Ask your host to check mod_security logs for blocked POST requests to /wp-json/wp/v2/posts, this is the cause nobody finds on their own.
  8. 8As a temporary workaround only, switch to the Classic Editor while you finish diagnosing, it does not use the REST API for saving.

Quick Tips

  • Loading /wp-json/ in a browser tells you in five seconds whether the REST API works at all
  • Re-saving permalinks fixes this more often than every other step combined, try it first
  • If /wp-json/ works but saving still fails, the block is on POST requests specifically, which means a firewall rule

Frequently Asked Questions

What does 'the response is not a valid JSON response' actually mean?
The block editor sent a save request to the WordPress REST API and expected JSON back. It got something else: an HTML error page, a redirect, a firewall block page, or an empty response. JavaScript in the editor tried to parse that as JSON, failed, and showed you the generic message. Your post content is almost never the problem, the transport between the editor and your server is.
Why does the error appear only on some posts and not others?
That pattern points at a firewall rule reacting to something in the content. mod_security and plugin firewalls scan the POST body and block requests containing what look like SQL fragments, script tags, iframes, or base64 strings. A post with an embed or a code block trips the rule, a plain text post does not. Ask your host for the mod_security log entry from the exact minute you got the error and you will see the rule ID.
Does re-saving permalinks really fix it?
Often, yes. The REST API depends on rewrite rules to route /wp-json/ requests. If those rules are stale after a migration, a plugin change, or an .htaccess overwrite, /wp-json/ returns a 404 HTML page instead of JSON. Visiting Settings > Permalinks and clicking Save Changes regenerates the rules without changing your URL structure, so nothing breaks and no links change.
Can an SSL problem cause this error?
Yes. If Settings > General says http but the site loads over https (or the reverse), the editor makes a cross-protocol request that the browser blocks or the server redirects. A redirect returns HTML, not JSON, and you get the error. Make both URL fields match exactly what you type into the browser, then clear caches and reload the editor.
Is Cloudflare or my CDN to blame?
It can be. Cloudflare's Bot Fight Mode and some WAF managed rules challenge POST requests to /wp-json/, and a challenge page is HTML. Create a Cloudflare rule that skips security features for URLs containing /wp-json/ and /wp-admin/, then retry. Also bypass cache for those paths so a cached response never reaches the editor.
Should I just install Classic Editor and move on?
Only as a stopgap. Classic Editor saves through admin-post.php instead of the REST API, so it sidesteps the error rather than fixing it. The underlying REST API failure still breaks the mobile app, scheduled publishing tools, contact form plugins, and anything else using /wp-json/. Use Classic Editor to get today's post out, then finish the diagnosis.
How do I check the REST API without any plugins?
Two ways. Open https://yoursite.com/wp-json/ in a browser, you should get a large JSON document listing routes. Or open Tools > Site Health > Status, WordPress runs a REST API test there and flags a failure with the HTTP status it received. Both take under a minute and tell you whether the problem is the API itself or only the save request.
Why did this start after I moved hosts?
Migrations commonly leave three things behind: stale rewrite rules, a mismatched site URL in the database, and a fresh server-level firewall you did not have before. Work them in that order. Re-save permalinks, check Settings > General, then ask the new host whether mod_security or an equivalent WAF is filtering POST requests to /wp-json/.

Related Guides

Sources and Further Reading

More guides in this area: Editor & Publishing troubleshooting hub