You finish editing a post, click Update, and a red bar slides in at the top of the editor: “Updating failed. The response is not a valid JSON response.” Your changes are not saved, and clicking Update again does nothing useful.
The “updating failed, the response is not a valid JSON response” error in WordPress looks like an editor bug, but it almost never is. It means the block editor asked your server for data, and the server sent back something that wasn’t data: an HTML error page, a firewall block screen, a redirect, or a PHP warning glued to the front of the reply. Find out which one, and the fix usually takes minutes.
Most guides hand you a list of ten things to try in random order. That’s backwards. The faster approach is to look at what the server actually returned, then fix that one thing.
What Does “The Response Is Not a Valid JSON Response” Mean?
The WordPress block editor saves posts by sending a request to the WordPress REST API (an address like /wp-json/wp/v2/posts/123) and expects a reply in JSON format. The “not a valid JSON response” error appears when that reply is anything other than clean JSON, so the editor can’t confirm the save and reports a failure.
JSON is a plain-text data format. The block editor (Gutenberg) is a JavaScript app running in your browser, and it reads the server’s JSON reply to know whether the save worked. If even one stray line of HTML or a PHP notice lands before the JSON, the whole reply becomes unreadable to the editor.
That’s why the same error message has so many different causes. The message only describes the symptom (“I got garbage back”), not what produced the garbage.
Step 1: See What the Server Actually Sent Back
The quickest way to diagnose the invalid JSON response error is to open your browser’s developer tools, click Update again, and read the failed REST API request in the Network tab. The response body tells you exactly which cause you are dealing with, which saves you from trying every fix blindly.
- In Chrome, Edge, or Firefox, press
F12(or right-click the page and choose Inspect). - Open the Network tab and type
wp-jsonin the filter box. - Click Update in the editor to trigger the error again.
- Click the request that turned red, then check the Status code and the Response (or Preview) tab.
Here’s how to read what you find:
| What the Network tab shows | Likely cause | Fix |
|---|---|---|
| 403 status, a “Forbidden” or “Access denied” page | Security firewall, ModSecurity, or Cloudflare WAF | Whitelist the REST API request or the blocked rule |
404 status on /wp-json/ | Broken rewrite rules or a missing .htaccess file | Re-save permalinks or regenerate .htaccess |
| 301/302 redirect, or an http vs https mismatch | Wrong WordPress Address or Site Address URL | Correct both URLs in Settings > General |
| 200 status, but “Warning:” or “Notice:” text before the JSON | PHP errors printed into the response | Turn off on-screen debug output and fix the plugin |
| 500 status | Fatal PHP error in a plugin or theme | Check the debug log and isolate the plugin |
You can also run a quick check without dev tools. Open https://yoursite.com/wp-json/ in a new tab. A working WordPress REST API returns a wall of JSON text. A login page, an error page, or a 404 tells you the problem sits between the editor and the REST API itself. WordPress Site Health (Tools > Site Health) flags the same thing with messages like “The REST API encountered an error.”
Fix 1: Re-Save Your Permalinks and Regenerate .htaccess
Re-saving permalinks rebuilds the WordPress rewrite rules that route /wp-json/ requests to the REST API, and it fixes the invalid JSON response error whenever those rules are missing or corrupted. Go to Settings > Permalinks and click Save Changes without changing anything.
If that doesn’t work on an Apache or LiteSpeed server, the .htaccess file itself may be damaged. Connect via your host’s File Manager or FTP, rename .htaccess to .htaccess_old, then save permalinks again so WordPress writes a fresh one. The default WordPress .htaccess block looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Changing your permalink structure is a different thing from re-saving it. If the site is already indexed, read how WordPress permalink structure affects SEO before switching formats, because a careless change can cost you rankings.
Fix 2: Check the WordPress Address and Site Address
A mismatch between the WordPress Address (URL) and Site Address (URL) in Settings > General can make REST API requests redirect, and a redirected request returns no usable JSON. Both fields should use the same domain and the same protocol, usually https://.
This mismatch shows up most often after moving a site to HTTPS, changing domains, or migrating hosts. If the URLs are correct but the site still loads some resources over HTTP, the problem is mixed content, and fixing a WordPress mixed content error covers the cleanup step by step.
If those fields are greyed out, they’re hardcoded in wp-config.php through the WP_HOME and WP_SITEURL constants. Edit them there instead.
Fix 3: Is a Firewall Blocking the WordPress Editor?
Security firewalls cause a large share of “updating failed” errors, because they sometimes treat a legitimate save request as an attack and replace the JSON reply with a block page. The usual suspects are a security plugin firewall, your host’s ModSecurity rules, and a Cloudflare WAF rule.
Firewall blocks are often content-specific. A post that contains a code snippet, an <iframe>, a <script> tag, or text that looks like a SQL query can trip a rule, while every other post saves fine. If only one post fails, that’s a strong sign the firewall is reacting to something inside it.
- Security plugin: temporarily disable the firewall module in Wordfence, Solid Security, or a similar plugin, then try saving. If it works, use the plugin’s allowlist or learning mode instead of leaving it off.
- ModSecurity on the server: ask your host to check the ModSecurity audit log for the blocked request and disable that one rule for your site. Turning ModSecurity off entirely is the lazy fix, not the right one.
- Cloudflare: open Security > Events in the Cloudflare dashboard, find the blocked request to
/wp-json/, and create a skip rule for that path while logged in as an admin.
Cloudflare deserves its own check because so many sites sit behind it. According to W3Techs, Cloudflare was used by 23.9% of all websites as of July 2026, which works out to roughly 84% of sites that use a known reverse proxy. If your site runs through Cloudflare, the guide to setting up Cloudflare for WordPress without breaking your site covers the settings that commonly interfere with wp-admin.
Fix 4: Stop PHP Errors From Leaking Into the Response
PHP warnings and notices printed to the screen are a common, overlooked cause of the invalid JSON response error. When WP_DEBUG_DISPLAY is on, or the server’s display_errors setting is enabled, any warning from a plugin gets printed in front of the JSON reply and breaks it.
The fix is to keep logging errors but stop displaying them. In wp-config.php, above the line that says “That’s all, stop editing!”, use:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Now save the post again. If it works, the error was cosmetic output, but the warning behind it is still real. Open /wp-content/debug.log, find the plugin or theme file named in the warning, and update or replace it. Once you’re done, set WP_DEBUG back to false on a live site.
A related, rarer cause: blank lines or spaces before the opening <?php tag in wp-config.php or a theme’s functions.php file. That whitespace gets sent before the JSON too. If you recently edited one of those files by hand, check the very top of it.
Fix 5: Rule Out a Plugin or Theme Conflict
If the Network tab shows a 500 error, or none of the earlier fixes worked, a plugin or theme is probably breaking the WordPress REST API. Deactivate all plugins, try saving, then reactivate them one at a time until the error returns. The last plugin you activated is the culprit.
Plugins that hook into the REST API are the most likely suspects: security plugins, caching plugins that cache wp-json responses, plugins that disable the REST API for “security,” and SEO or translation plugins that rewrite URLs. Switch to a default theme like Twenty Twenty-Five as well, since themes can break the REST API in the same way.
On a live business site, do this testing on a copy first. The full process, including the Health Check plugin’s troubleshooting mode that disables plugins only for your own session, is in how to find which WordPress plugin is causing a problem.
Should You Just Install the Classic Editor?
Installing the Classic Editor plugin hides the invalid JSON response error, but it doesn’t fix it. The Classic Editor saves posts through a normal form submission instead of the REST API, so the broken REST API is still there, waiting to break anything else that depends on it.
And plenty of things depend on it. The block editor, the Site Editor, WooCommerce admin screens, many form and page builder plugins, and mobile apps all talk to WordPress through the REST API. Using the Classic Editor as a stopgap to publish something urgent is fine. Treating it as the fix is how a small problem turns into a broken site six months later.
The Takeaway
The “updating failed, the response is not a valid JSON response” error is always a communication failure between the block editor and the WordPress REST API. Don’t start by disabling plugins at random. Open the Network tab, read what the server actually returned, and match it to the cause: a firewall block, broken rewrite rules, a URL mismatch, leaked PHP warnings, or a conflicting plugin. Fix that one thing, and the Update button goes back to working.
Frequently Asked Questions
WordPress shows this error when the block editor sends a save request to the REST API and gets back something other than valid JSON, such as an error page, a firewall block page, a redirect, or PHP warnings. The most common causes are security firewalls, broken permalink rewrite rules, mismatched site URLs, and plugin conflicts.
The changes that triggered the invalid JSON response error are usually not saved to the database, but they often still exist in the open editor tab and in the browser’s local autosave backup. Before refreshing the page, copy your content somewhere safe so you don’t lose it while you fix the error.
When only one WordPress post fails to save, a security firewall such as ModSecurity, Cloudflare WAF, or a security plugin is usually blocking something inside that post’s content, like a code snippet, script tag, or iframe. Check the firewall’s log for the blocked request and allowlist that specific rule.
Visit yoursite.com/wp-json/ in your browser: a working WordPress REST API returns a page of JSON text, while an error page or 404 means it is blocked or broken. You can also go to Tools > Site Health in the WordPress dashboard, which reports REST API errors automatically.
The Classic Editor plugin avoids the invalid JSON response error because it saves posts without using the REST API, but it does not fix the underlying problem. Other features that rely on the REST API, including the Site Editor, WooCommerce admin screens, and many plugins, can still fail until the real cause is fixed.

Leave a Reply