More fixes

WordPress says "Updating failed. The response is not a valid JSON response"

You press Update or Publish in the WordPress editor and a black bar says the save failed: "The response is not a valid JSON response". The editor sends your page to the site and expects a short data reply (JSON) back. Something got in the way and the site answered with a web page instead: a "not found" page, a firewall's "forbidden" page, or a PHP warning stuck in front of the data. The message is the same in every case, so the fix starts with finding out which reply came back. Below is a rebuilt example (not a real client), then the order of steps.

What the owner sees after pressing Update

brightsidebakery.example/wp-admin/post.php?post=12&action=edit

What the checks found


  

Find out what the site sent back (five minutes)

  1. Does it fail on every page, or only this one? Make a new draft with one word in it and press Save draft. If the empty draft saves, the problem is something in this page's content (usually a firewall objecting to it, see step 4 below). If nothing saves anywhere, it is site-wide.
  2. Open your site's data address in a new tab: https://yoursite.com/wp-json/. A healthy site shows a screen of text and brackets. Your theme's "page not found" or the host's plain "Not Found" page means the addresses WordPress uses for saving are not reaching it (step 2 below). A "Forbidden" or "Not Acceptable" page means a firewall is in the way (step 4).
  3. Ask WordPress itself. Tools, Site Health. Under Status, a line such as "The REST API encountered an error" or "The REST API encountered an unexpected result" confirms it and usually quotes the error.
  4. Read the failed save in the browser if the two checks above look fine. On a computer, press F12, open the Network tab, press Update again, and click the red line whose name starts with the page or post number (it goes to wp-json/wp/v2/pages/... or .../posts/...). The Response tab shows what came back. A "Warning:" or "Deprecated:" line before the { means a plugin or the theme is printing errors into the reply (step 5).

The fixes, in the order to try them

  1. Back up first. In the host's control panel, take a backup or at least download .htaccess and wp-config.php. Copy the text of the page you were editing somewhere safe: an unsaved edit is lost if the tab closes.
  2. Re-save the permalinks. Settings, Permalinks, change nothing, press Save Changes. This rewrites the rules that send /wp-json/ addresses to WordPress. If /wp-json/ still shows a not-found page, the .htaccess file is missing or ignored, often after a host move; the pages 404 guide has the standard file and what to check on the server.
  3. Check the two site addresses. Settings, General: "WordPress Address" and "Site Address" must both start with https:// if the site has a certificate, and match the address in your browser bar. An http:// address there sends the editor's save to an insecure address that the browser blocks or redirects, and a redirected save loses its data. If the dashboard misbehaves after changing them, the login loop guide has the reversible wp-config.php way.
  4. Let the save past the firewall. If only some pages fail, or /wp-json/ says Forbidden or Not Acceptable, a security filter is refusing the save. Pages with embedded code, form or map snippets, or text that looks like database commands are the usual trigger.
    • Host firewall (ModSecurity): its block page often names it. Ask the host's support to allow your site's /wp-json/ saves, or, if your control panel has a ModSecurity switch, turn it off for this domain only, save, and turn it back on.
    • A security plugin (Wordfence, Sucuri, iThemes and similar): look in its firewall or blocked-requests log for the time you pressed Update, and allow that request. Wordfence also has a short "learning mode" for exactly this.
    • Cloudflare or another CDN: the firewall events log shows the block; add a skip rule for the save addresses under /wp-json/wp/v2/ rather than turning the firewall off for the whole site.
  5. Stop errors printing into the reply. In wp-config.php, if you find define( 'WP_DEBUG', true );, add define( 'WP_DEBUG_DISPLAY', false ); below it so warnings go to the log instead of into the save. Then update the plugin or theme the warning names, or switch it off.
  6. Switch plugins off to find the culprit if nothing above explains it. Plugins, Installed Plugins, select all, Bulk actions, Deactivate, try saving, then switch them back on one at a time, saving after each. If the dashboard cannot be used, rename wp-content/plugins in the file manager instead (renaming keeps every setting).
  7. Test: save a draft, update a real page, upload an image in the editor, and check the page on your phone.

What came back, what it means, what it needs

What you findWhat it meansUsual fix
/wp-json/ shows a "page not found"The saving addresses never reach WordPress (rewrite rules missing)Save Permalinks; restore .htaccess (pages 404 guide)
"Forbidden", "Not Acceptable" or a security plugin's block pageA firewall refused the save, often because of code or unusual text in the pageAllow the request in the plugin, the host's ModSecurity, or the CDN's firewall
Fails on one page only, empty drafts save fineThe page's content trips a filterSame as above; until then, remove the snippet, save, add it back in a Custom HTML block
Site address in Settings starts with http:// on an https siteThe save goes to an insecure address and is blocked or redirectedSet both addresses to https://
"Warning:", "Notice:" or "Deprecated:" text before the dataA plugin or theme prints PHP errors into the replyWP_DEBUG_DISPLAY false; update or replace what the warning names
Started right after installing or updating one pluginThat plugin interferes with savingSwitch it off, check for an update, tell its author

What not to do

Most sites need step 2 or step 4, and either takes a few minutes once you know which one it is. If the editor is still refusing to save, or the page has to go live today, that is what the box below is for. Related: pages that 404 except the home page share the first cause, and "there has been a critical error" is what a broken plugin looks like from the front of the site.