“The response is not a valid JSON response” in WordPress: what we could trigger
In short
The block editor says "The response is not a valid JSON response" when its save request gets back something that is not JSON. On our 13 Oct 2026 test site two things did it: a plugin printing HTML into the reply, and a firewall's HTML 403 page. $45 for one problem: cause in writing before anything changes, staging copy first.
Seeing this on your own site? Send us the address for a free site check, and a written report comes back within 2 business days.
Key points
- A plugin that printed one line of HTML broke every save. The post was still saved, and a "failed" publish went live.
- A firewall stand-in that blocked the save with an HTML 403 page gave the same message, and that time nothing was saved.
- Blank lines and a byte order mark before the reply did not cause it, and neither did a PHP warning with WP_DEBUG on.
- A PHP fatal error during the save gave "Updating failed." with no JSON wording at all.
On this page (10)
- Why does WordPress say “The response is not a valid JSON response”?
- How did we test it?
- Which causes actually triggered the error?
- Which common fixes did nothing?
- Did the post save when WordPress said it failed?
- How do you find the real cause?
- How do you fix “The response is not a valid JSON response”?
- What did we not test?
- Is the editor still refusing to save after these steps?
- Questions and answers
Why does WordPress say “The response is not a valid JSON response”?
The block editor saves through the WordPress REST API and expects JSON back. When the reply is not a valid JSON response, it shows “Updating failed. The response is not a valid JSON response.” On Publish the first word is “Publishing”.
The message comes from WordPress’s own fetch code (api-fetch.js, lines 357 to 358 in 7.1.3, error code invalid_json). It tells you the reply was wrong. It does not tell you what wrote it.
Fixing a failed save like this is on the list of one-off jobs on our WordPress maintenance page. We rehearse the change on a duplicate of your site before touching the live one.
How did we test it?
On 13 Oct 2026 we built a site on WordPress Playground with WordPress 7.1.3, PHP 8.3 and pretty permalinks. A small must-use plugin switched on one fault at a time.
A script logged in, opened a new post in the block editor and pressed save. It recorded the editor’s notice, the save reply’s status and its first 160 characters, and took a screenshot.
Which causes actually triggered the error?
Two of six:
| Fault we switched on | What the editor said | What the save got back |
|---|---|---|
| Plugin prints a line of HTML | Updating failed. The response is not a valid JSON response. | 200, the HTML line, then the JSON |
| Firewall blocks the save with a 403 page | Updating failed. The response is not a valid JSON response. | 403, an HTML “Forbidden” page |
| Two blank lines before the reply | Draft saved. | 200, JSON with the blank lines in front |
| Byte order mark before the reply | Draft saved. | 200, JSON |
| PHP warning, WP_DEBUG on | Draft saved. | 200, clean JSON |
| PHP fatal error during the save | Updating failed. | 500, JSON with “There has been a critical error on this website.” |
Our plugin printed <p class="lab-promo">Lab plugin: upgrade to Pro</p> in front of the JSON. One stray tag was enough.
Which common fixes did nothing?
We expected whitespace and debug mode to matter. Neither broke a save in our lab.
Blank lines and a byte order mark in front of the reply were read as JSON. They are still worth removing: the blank lines put 20 “headers already sent” warnings in the PHP log in one run. Our lab on the WordPress headers already sent warning shows how to find the file that printed them.
WP_DEBUG on did not leak the warning either. WordPress 7.1.3 turns display_errors off for REST and JSON requests (wp-includes/load.php, lines 642 to 646; see wp_debug_mode() in the WordPress docs). The warning went to the log, and the post saved.
A PHP fatal is a different problem. WordPress wraps it in JSON, so the editor just says “Updating failed.” The fatal itself is in the log, which we traced in WordPress memory exhausted and the critical error.
Did the post save when WordPress said it failed?
With the plugin fault, yes. Every “failed” save in that case wrote the post. The publish that said “Publishing failed” was published when we opened the Posts list.
So check Posts before you paste your content into a new post. With the firewall fault nothing was saved, because the request was stopped before WordPress saw it.
How do you find the real cause?
Look at what the editor got back. In Chrome or Firefox:
- Open developer tools and the Network tab.
- Save the post again.
- Click the save request, the one to wp/v2/posts followed by the post ID.
- Read the status and the Response tab.
A 200 with HTML before the opening brace points at a plugin or theme printing output. In our lab the stray HTML carried the class lab-promo, which pointed straight at the plugin. A 403 with a “Forbidden” or “blocked” page points at a security plugin, the host’s firewall or a CDN rule.
How do you fix “The response is not a valid JSON response”?
Remove whatever wrote the bad reply.
For output in front of the JSON, deactivate plugins one at a time on a staging copy and save after each. When we switched our printing plugin off, the next save said “Draft saved.” with a clean JSON reply.
For a 403, find the rule that blocked the save. Check the tool’s log of blocked requests if it has one. Allow requests to /wp-json/ for logged-in editors, or ask the host which rule fired. When our firewall stand-in stopped blocking, the save went through. We have not tried this on a real security plugin or CDN.
We take this on as a single paid job. First we capture the failing save reply, trace it to the plugin or server rule that wrote the extra output, and switch that off on a staging copy. Only then does the live site get the change.
Site Health (Tools > Site Health) has its own check, “The REST API is available”, listed in the WP_Site_Health developer docs. We did not run it in this lab, so we cannot say whether it catches these faults. Our post on Site Health critical issues covers how to read that screen.
What did we not test?
- Real security plugins, ModSecurity, and Cloudflare or other CDN rules. Our firewall was a stand-in that returned an HTML 403. Our post on the WordPress 403 Forbidden error tells a firewall 403 apart from a stale security check.
- Permalink and .htaccess problems, which need Apache or nginx. Playground has neither. Our post on WordPress 404 errors after a permalink change covers the rewrite rules WordPress stores itself.
- An http and https mix, or a Site Address that differs from the WordPress Address.
- Image uploads in the editor and the classic editor.
- Page builders. The same stray PHP warning also froze the Elementor editor in a later lab, and Safe Mode did not clear it: see why Elementor is not loading.
Is the editor still refusing to save after these steps?
Send us the save reply from the Network tab, or just the message on screen. We find the cause on a staging copy before we change anything. One fix: $45 for 1 problem, done in 2 days, and if we start and cannot fix it, you do not pay for that job. Prices in US dollars; you pay a Stripe invoice.
Unsure where the fault sits? Request the free site check by sending the site address, and you get a written answer inside 2 business days. If you already know what needs fixing, see the one-off fixes listed here.
Where did these facts come from?
- WordPress developer docs, wp_debug_mode(), checked Oct 13, 2026
- WordPress developer docs, Debugging in WordPress, checked Oct 13, 2026
Questions and answers
Did my post save when WordPress said updating failed?
It can have. In our lab the plugin case saved the draft every time, and a publish that said "Publishing failed" was live in the Posts list. Check Posts before you paste the content again.
Does turning off WP_DEBUG fix the invalid JSON error?
Not in our lab. WordPress 7.1.3 already hides PHP warnings from editor save requests, so the save worked with WP_DEBUG on and off.
How do I see what the editor got back?
Open the browser's developer tools, go to the Network tab, save again, and click the request to wp/v2/posts. The Response tab shows the first thing that is not JSON.
Still stuck? Send us the page address and what you see Want to know if the problem stops here? Ask for the free site check.
We write up one real fix or build a few times a week. Follow DistroCode on LinkedIn


