Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting · Troubleshooting

How to Fix "Updating Failed. Not a Valid JSON Response" in WordPress

Short answer

The error means the block editor asked the WordPress REST API to save your post and got something other than JSON back, such as an HTML error page, a redirect, or a firewall block page. Start by opening yoursite.com/wp-json/ in a browser: valid JSON means the API works, while a 404, 403, or redirect points to the cause. Then work through the fixes in order: resave permalinks, match the site URLs, test plugins and theme, and check firewall rules.

Key takeaways

  • The block editor saves posts through the REST API at /wp-json/, so a broken API response stops every save.
  • Open yoursite.com/wp-json/ first: JSON means the API works, while a 404, 403, or redirect names the cause.
  • Resaving permalinks rebuilds the rewrite rules that route /wp-json/ requests, and it fixes many cases in seconds.
  • A 403 usually means a firewall or security plugin blocked the save; check the rule log instead of disabling all security.
  • PHP warnings printed before the JSON break the response, so log errors to a file instead of showing them on screen.
  • If the error appears on one post only, its content likely trips a firewall rule; save the post in parts to find the trigger.

What does “Updating failed. The response is not a valid JSON response” mean?

It means the block editor sent your save to the WordPress REST API and got back something that is not JSON, so it could not confirm the save.

The editor saves through the REST API, which lives at /wp-json/ on your site. WordPress's own Site Health reference states that the block editor relies on the REST API to display and save posts and pages.

When the reply is clean JSON, the editor shows a saved notice. When the reply is an HTML error page, a redirect, a login screen, or JSON with a PHP warning stuck to the front, the editor rejects it and shows this message.

Your post may still have saved on the server even when the notice appears. Reload the editor and check the post before you try the save again, so you do not create a duplicate.

Image uploads in the editor also go through the REST API, so the same fault can break uploads. If uploads fail with their own error, see our guide on fixing the HTTP error when uploading images.

Why does the block editor need JSON to save?

The editor is a JavaScript app in your browser, and it talks to WordPress through the REST API instead of submitting a form.

Each save is a request to a route such as /wp-json/wp/v2/posts/123, with your content sent as JSON. The REST API Handbook explains that a GET to /wp-json/ returns a JSON index of every route and endpoint on the site.

JSON is a strict format, so even one extra line before it breaks the whole reply. A PHP warning, a stray blank line from a plugin, or an HTML page from a firewall all make the reply unreadable to the editor.

The core endpoints arrived with WordPress 4.7, as the REST API discovery guide explains, so any modern install has them. The old classic editor saved with a plain form post, so it never hit this problem, and switching editors hides the message without fixing the broken API underneath.

How do you find the real cause in two minutes?

Open yoursite.com/wp-json/ in your browser while logged in, and read what comes back instead of guessing.

  • A wall of JSON text: the API works, so the fault is likely in the save itself or in one post.
  • A 404 page: the rewrite rules are broken, so start with permalinks.
  • A 403 page: a firewall or security plugin is blocking the API.
  • A redirect to another address: the site URLs do not match.
  • A 500 page or a blank screen: a plugin or theme is failing on the server.

Next, open Tools → Site Health → Status in your dashboard. Site Health runs a REST API test with a 10-second timeout against the post type route, and it reports “The REST API encountered an error” when the test fails, as shown in the WordPress developer reference.

For the exact reply, open the post editor, press F12, choose the Network tab, and click Update. Chrome's DevTools guide explains that the Network panel logs every request and that clicking a row shows its headers and response.

If Site Health also reports a loopback failure, read our guide on fixing loopback request failures.

What does each status code tell you?

The status code of the failed request points to the layer that broke, so read it before you change settings.

StatusWhat you seeLikely causeStart with
404Theme 404 page or server 404Broken permalinks or rewrite rulesResave permalinks
403Forbidden or a block pageFirewall, ModSecurity, or security pluginCheck firewall logs
401Login page or auth errorSession expired or REST access limitedLog in again
500Server error page or blank replyPHP fatal from a plugin or themeCheck the debug log
200Warning text before the JSONPHP warnings printed into the replyHide on-screen errors
301 or 302Browser sent to another URLSite URL mismatch or redirect pluginMatch the site URLs

A 500 reply from the API often comes with a wider site fault, so our guide to fixing the 500 internal server error covers the same checks.

A 403 reply means something blocked the request on purpose, and our 403 forbidden guide walks through the same checks.

Go to Settings → Permalinks and click Save Changes without changing anything, then try saving the post again.

WordPress.org's permalink documentation states that visiting the Permalinks screen triggers a flush of rewrite rules, so the save rebuilds the rules that route /wp-json/ requests.

As a quick check, open yoursite.com/?rest_route=/ in your browser. The REST API Handbook says that if pretty permalinks are off, routes work through this query string instead.

If WordPress shows “You should update your .htaccess now.”, the file is not writable. Copy the rewrite rules shown on the screen into .htaccess by hand, using SFTP or your host file manager.

With WP-CLI, the same fix is one command: wp rewrite flush. The WP-CLI docs note that adding --hard also updates the .htaccess rules on a single site install.

If posts also show 404 errors on the front of the site, read our guide on fixing 404 errors on posts.

How do you match the WordPress Address and Site Address?

Open Settings → General and check that WordPress Address and Site Address use the same scheme, domain, and www choice, both starting with https.

WordPress.org's general settings documentation explains that the WordPress Address is where the core files live, while the Site Address is what visitors type, and the two match unless WordPress sits in its own directory.

A mismatch sends the editor's save to the wrong address, and the redirect that comes back is not JSON. Fix both fields, save, and log out and back in so the editor picks up the new addresses.

If the fields are greyed out, a WP_SITEURL or WP_HOME constant in wp-config.php is setting them. Change the constants there instead of in the dashboard.

How do you find a plugin or theme conflict?

Switch to a default theme such as Twenty Twenty-Four and try the save again; if it works, your theme is the cause.

Then test plugins with the Health Check & Troubleshooting plugin. Its Troubleshooting Mode gives you a clean session with all plugins disabled and a default theme, but only for your user, as its WordPress.org page explains.

Reactivate plugins one at a time and save after each one. When the error returns, the last plugin you turned on is the cause.

Pay extra attention to security, caching, and redirect plugins, since they sit between the editor and the API. If the error appears only when a certain block or shortcode is in the post, test with that content removed.

How do you stop PHP warnings from breaking the response?

Add WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY lines to wp-config.php so errors go to a log file instead of into the page.

WordPress's debugging handbook gives the exact lines: WP_DEBUG true, WP_DEBUG_LOG true, WP_DEBUG_DISPLAY false, plus @ini_set('display_errors', 0), placed before the “That's all, stop editing!” line.

WP_DEBUG_LOG only writes when WP_DEBUG is true, so set both constants.

The log lands in wp-content/debug.log. Reproduce the failed save, open the log, and look for the file and line named in the newest warning, then fix or replace that plugin or theme.

PHP's own manual states that display_errors controls whether errors print to the screen, and it advises logging errors instead of showing them on production sites.

Turn WP_DEBUG off again when you finish. WordPress advises against running debug tools on live sites, and a growing debug.log can fill disk space.

How do you clear a firewall or security block?

Check the block log first: a 403 with no log entry is hard to fix, while a named rule tells you exactly what to allow.

In Cloudflare, open Security → Events and look for blocked requests to /wp-json/. Cloudflare's WAF docs describe these blocks as false positives when a real request is caught, and advise disabling the one rule that fired instead of the whole ruleset.

On cPanel hosts, ModSecurity can block saves that hold code, script tags, or SQL-like text. Ask your host to check the ModSecurity log for your domain and allow the rule for /wp-json/ only.

In a security plugin, look for a setting that limits REST API access and allow it for logged-in users. Turn the block off only while you test, then turn it back on with an exception for the API route.

If the error hits one post only, its content is likely the trigger. Save the post in halves to find the paragraph that trips the rule, then ask the host or plugin author to allow that content.

How do you confirm the fix worked?

Save the same post that failed, then check that the notice changes to “Post updated” and the changes appear on the live page.

  • Reload /wp-json/ and confirm it returns JSON, not an error page.
  • Open Tools → Site Health → Status and confirm the REST API test passes.
  • Upload an image inside the editor to confirm media saves work too.
  • Save a second post, and one page, to confirm the fix is not limited to one post.

If the error returns the next day, the cause is still there. Note the time, the post, and the status code, and work through the fixes again from the top.

When should you call your host?

Call the host when /wp-json/ still fails after permalinks, URLs, plugins, theme, and firewall checks, since the fault is then on the server.

Ask for three things: the ModSecurity or WAF log entries for /wp-json/, the server error log for the time of the failed save, and the PHP version. WordPress.org recommends PHP 8.3 or greater as of November 2026, so an old PHP version is worth checking too.

For the full list of supported versions, see our guide to WordPress minimum requirements.

Also call the host when the error started right after a server move, an SSL change, or a PHP upgrade. Those changes can break rewrite rules, certificates, or file paths in ways the dashboard cannot fix.

Send the host the exact status code and the first lines of the failed response. A 403, a 500, and a redirect each point to a different team, so the detail saves a round of questions.

What mistakes should you avoid?

Do not switch to the classic editor and call the job done, since the broken API still affects other features.

  • Do not turn off all security to test the save; disable one rule at a time and turn it back on.
  • Do not edit .htaccess without a backup copy, since one wrong line can take the whole site down.
  • Do not leave WP_DEBUG on after the fix, since warnings can leak into pages and the log keeps growing.
  • Do not guess at the cause from the message alone; the notice never says what the server sent back.

Frequently asked questions

Does this error mean my post content is lost?

Not always. The save may have reached the server even when the confirmation failed, so reload the editor and check the post before you type it again. If the content is gone, check Revisions under the post, since WordPress stores autosaves there. Copy your text to a file before you start fixing, so a reload cannot lose it.

Why does the error happen on only one post?

A single post can trip a firewall rule when it holds code samples, script tags, or text that looks like a database command. ModSecurity and WAF rules scan the content of each save, so other posts pass while that one is blocked. Save the post in halves to find the paragraph that triggers the rule, then ask your host to allow it.

Can a caching plugin cause this error?

Yes, if it caches admin pages or the REST API responses. A cached admin page can serve a stale security token, and a cached API reply can return old data instead of a fresh save. Clear the cache and exclude /wp-json/ and /wp-admin/ from caching, then save again to see if the error clears.

Is it safe to turn off ModSecurity to fix this?

No, turning it off for the whole site removes a layer of defense. Ask your host to find the exact rule that blocks /wp-json/ and allow only that rule for the API path. If the host cannot allow one rule, switch the rule to log-only mode while you test, then restore it.

What if /wp-json/ works but saving still fails?

Then the fault sits in the save itself, not the API route. Turn on WP_DEBUG_LOG, reproduce the failed save, and read wp-content/debug.log for the plugin or theme named in the newest warning. Also test with a default theme and all plugins off, since a conflict can break only the save request.

Sources

  1. Key Concepts – REST API Handbook WordPress Developer Resources
  2. WP_Site_Health::get_test_rest_availability() WordPress Developer Resources
  3. Debugging in WordPress WordPress Developer Resources
  4. Settings Permalinks Screen WordPress.org Documentation
  5. Requirements WordPress.org
  6. Troubleshoot WAF Managed Rules Cloudflare Docs
  7. Inspect Network Activity Chrome for Developers
  8. Runtime Configuration: Errors and Logging PHP Manual

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test