WordPress "Updating Failed" or "Publishing Failed"? How to Fix the Not a Valid JSON Response Error
Fix WordPress "Updating failed" and "The response is not a valid JSON response" errors: permalinks, SSL, firewalls, plugins and the REST API.

On this page
- WordPress updating failed: quick diagnosis table
- Why the block editor shows "not a valid JSON response"
- Fix 1: Re-save your permalinks
- Fix 2: Make the site URLs match your HTTPS address
- Fix 3: Check your firewall and security plugin
- Fix 4: Look for a plugin or theme conflict
- Fix 5: Check the server error log and PHP limits
- Fix 6: Use Site Health to confirm the REST API works
- "Updating failed" when uploading images in the editor
- Errors on Indian shared hosting
- How to stop "Updating failed" coming back
- Quick check: is the REST API reachable?
- When to get help
- FAQs
- The block editor saves through the REST API, so "Updating failed" means that request was blocked, redirected or broken.
- Most cases are fixed by re-saving permalinks, matching the site URLs to HTTPS, or allowing the request in a firewall or security plugin.
- Copy your content before testing, then check Site Health, the browser console and plugin conflicts in that order.
When WordPress shows "Updating failed" or "Publishing failed. The response is not a valid JSON response", the block editor tried to save your page through the WordPress REST API and got something other than the answer it expected. The fix is usually one of five things: re-save your permalinks, make the WordPress and Site Address URLs match your real HTTPS address, allow the request in your firewall or security plugin, find a plugin that prints errors into the response, or fix a server rule in .htaccess.
Before you try anything, copy the text of the post you are editing into a plain text file. The editor keeps an autosave in some cases, but not always, and the error often appears exactly when you have written the most.
WordPress updating failed: quick diagnosis table
| What you see | Most likely cause | First fix |
|---|---|---|
| "Updating failed. The response is not a valid JSON response" on every page | Permalinks or .htaccess broken, so REST API URLs return 404 | Settings > Permalinks > Save Changes |
| Error started after moving to HTTPS or a new domain | Site URLs still on http or the old domain | Match both URLs in Settings > General |
| Only some posts fail, often ones with code, scripts or certain words | Firewall or security plugin blocking the request | Check the firewall log and allow the request |
| Error started after a plugin or theme update | PHP notice or extra output breaking the JSON | Plugin conflict test |
| "Updating failed. You are probably offline" | Connection dropped, or a timeout on slow hosting | Check your connection, then the server error log |
| Error only when uploading an image inside the editor | Upload limits or the image library | See the image upload fixes below |
Why the block editor shows "not a valid JSON response"
The block editor (Gutenberg) does not submit a normal form when you click Update. It sends your content to an address such as /wp-json/wp/v2/pages/123 and expects a short reply written in JSON. If that address returns a 404 page, a firewall block page, a login redirect, a PHP warning or an HTML error page instead, the editor cannot read it and shows the generic error.
So the message does not tell you what went wrong; it tells you that something sat between the editor and WordPress. If you want the background, the WordPress REST API explained covers what these requests are and why you should restrict the REST API rather than switch it off.
Fix 1: Re-save your permalinks
This is the quickest fix and solves a large share of cases. Go to Settings > Permalinks and click Save Changes without changing anything. WordPress rewrites its URL rules, including the ones for /wp-json/.
Then open yourdomain.com/wp-json/ in a browser. You should see a page of structured text starting with the site name. If you see your theme's 404 page instead, the rewrite rules are still not working. On Apache or LiteSpeed hosting, check that the .htaccess file in the site root contains the standard WordPress block. If ordinary pages also show 404 errors, follow the fix for WordPress pages showing 404 first, because it is the same problem.
If you use the "Plain" permalink setting, the REST API lives at ?rest_route=/ instead. Switching to "Post name" is better for SEO anyway, but set up redirects if the site already has traffic.
Fix 2: Make the site URLs match your HTTPS address
Open Settings > General and look at WordPress Address (URL) and Site Address (URL). Both should show the exact address visitors use, including https and either www or no www. A mismatch is common after installing an SSL certificate, moving hosting or changing domain.
When they don't match, the editor sends its save request to one address and the server redirects it to another. Browsers don't carry the request body across that redirect in a way WordPress accepts, so the save fails. If changing these fields causes a redirect loop and locks you out, see how to fix ERR_TOO_MANY_REDIRECTS in WordPress, and check for padlock warnings once it saves again.
Fix 3: Check your firewall and security plugin
Security tools are the most common cause when only some posts fail. A web application firewall reads every request, and a post containing an iframe, a script tag, a SQL example or words that look like an attack can match a rule and be blocked. The editor then receives a block page instead of JSON.
- Open your security plugin's firewall or activity log (Wordfence, Sucuri, Solid Security, All In One WP Security or similar) and look for blocked requests to /wp-json/ at the time you clicked Update.
- If you find one, use the plugin's option to allow that specific request or rule for logged-in administrators, rather than turning the firewall off.
- Check settings that "disable the REST API" or "restrict REST API to logged-in users". Restricting it to logged-in users is fine; disabling it entirely breaks the editor.
- Check server-level tools too: ModSecurity in cPanel or hPanel, Cloudflare WAF rules and your host's own firewall. Hosting support can see ModSecurity hits in the server logs and whitelist the rule ID.
WordPress firewalls explained covers the difference between plugin, server and DNS-level firewalls, and how to deal with false positives without lowering protection for everyone.
Fix 4: Look for a plugin or theme conflict
If the error started after an update, a plugin or the theme may be printing a PHP warning, a blank line or extra HTML before the JSON reply. One stray character is enough to break it.
- Open the editor, press F12 and choose the Network tab. Click Update, then click the failed request (it usually has the post ID in its name) and read the Response tab. A PHP warning naming a plugin folder tells you the culprit straight away.
- If nothing obvious shows, install Health Check & Troubleshooting and use Troubleshooting Mode. It disables plugins and switches to a default theme for your login only, so visitors see nothing.
- Re-enable plugins one at a time and try to update a test draft after each.
The full method, including how to test safely on a live site, is in how to fix WordPress plugin conflicts safely. Plugins that add SEO meta boxes, custom fields, page builders, caching and security headers are the usual suspects, because they all hook into saving.
Fix 5: Check the server error log and PHP limits
If the Network tab shows a 500 status, the server crashed while saving. Open the error log in your hosting panel and look for lines around that time. "Allowed memory size exhausted" means PHP memory is too low; "Maximum execution time" means the save took too long, which happens on very long pages or slow shared hosting. A 403 status means a permission or server rule refused it. The WordPress 500 error guide walks through reading those logs.
Fix 6: Use Site Health to confirm the REST API works
Go to Tools > Site Health. If WordPress cannot reach its own REST API, it shows a critical issue such as "The REST API encountered an error" with the HTTP status code. Fix that issue and the editor usually saves again. Run the check again after every change so you know which fix worked.
"Updating failed" when uploading images in the editor
If the message appears only when you drag an image into the editor, the problem is the upload rather than the save. Large photos straight from a phone, low upload limits and missing image libraries on the server all cause it. See the HTTP error when uploading images fix and resize images before upload.
Errors on Indian shared hosting
Many Indian business sites run on shared plans where ModSecurity rules, low PHP memory and aggressive caching are set by the host. Two things come up often on these plans:
- ModSecurity false positives. Pages that embed a Google Map, a YouTube video or a WhatsApp chat link can trigger generic rules. Raise a ticket with the exact time of the failed save and ask the host to check ModSecurity logs.
- Caching of /wp-json/. Some server caches or CDN rules cache everything. The REST API should never be cached for logged-in users, so exclude /wp-json/ and wp-admin from page cache and Cloudflare cache rules.
How to stop "Updating failed" coming back
- Update plugins in small groups and test saving a draft afterwards, ideally on a staging copy first; see staging sites explained.
- Keep only one security plugin, and keep its REST API option on "logged-in users only" rather than "disabled".
- After any SSL, domain or hosting change, check both site URLs and re-save permalinks.
- Watch Site Health once a month. It flags REST API and loopback problems before editors notice them.
If the editor keeps failing and you can't find the cause, a WordPress maintenance plan covers this kind of fault, or you can hire a WordPress developer in India for a one-off fix. I'd start with the browser's Network tab and the server log, because together they name the cause in most cases.
Quick check: is the REST API reachable?
- Open Tools > Site Health > Status and look for "The REST API encountered an error" or "unexpected result".
- Visit
yourdomain.com/wp-json/in your browser. You should see JSON text, not an error page. - If either fails, disable security and firewall plugins with the Health Check & Troubleshooting plugin and test again.
If the site shows "There has been a critical error on this website" instead, follow how to fix the WordPress critical error step by step.
When to get help
Get help when the REST API is blocked by your host's firewall, when the error appears only on some posts, or when it started after a migration or SSL change. WordPress maintenance and support covers diagnosis and repair. You can also hire a WordPress developer in India, or send the details through the contact form.
FAQs
What does "Updating failed. The response is not a valid JSON response" mean?
The block editor saves through the REST API and expects a JSON reply. It received something else, such as a 404 page, a firewall block page, a redirect or a PHP error. The message is generic; the cause is whatever replaced the reply.
Why does WordPress say "Publishing failed" on a new post?
It is the same error as "Updating failed", shown when the post has not been published yet. Work through the same fixes: permalinks, site URLs, firewall, plugins and server logs.
Will switching to the Classic Editor fix updating failed?
It often hides the symptom, because the classic editor saves through a normal form instead of the REST API. But anything else that uses the REST API, including some plugins and forms, may still be broken, so fix the cause rather than switching.
Can a security plugin cause the WordPress updating failed error?
Yes. Firewall rules can block a save that contains scripts, iframes or code samples, and options that disable the REST API break the block editor entirely. Check the plugin's log and allow the request for administrators.
Will I lose my content when updating fails?
The text stays in the editor while the tab is open, and WordPress may keep an autosave. Copy the content somewhere safe before refreshing or testing fixes, and check Revisions afterwards.
Why does updating fail only on one page?
When one page fails and others save, the content of that page is usually the trigger: an embed, a script, a very long table or a code sample matching a firewall rule. Try saving a copy with half the content removed to find the block responsible.
Need help with your website?
I'm a freelance WordPress developer building fast, SEO-friendly websites since 2020. Tell me what you need and I'll reply with a plan and a fixed quote, usually within 24 hours.


