WordPress: Updating failed. The response is not a valid JSON response.
The block editor saved via the REST API but got HTML or an error page back — broken permalinks, a security plugin/WAF, or PHP output before the JSON.
Meaning
Gutenberg talks to /wp-json/. If that URL returns a 404/403 page, a ModSecurity block, a login redirect, or JSON polluted by PHP notices, the editor reports this message.
Common causes
- Permalinks/rewrite rules broken so /wp-json/ 404s
- Security plugin / ModSecurity / Cloudflare WAF blocking the REST request
- PHP warnings or BOM printed before the JSON
- Site URL mismatch (http vs https, www vs non-www) → redirect
- REST API disabled by a plugin
⚡ Quick fix
- Visit
https://yoursite.com/wp-json/— it should show JSON - Re-save Settings → Permalinks
- Temporarily disable security/caching plugins
- Check browser DevTools → Network for the failing request’s response
Detailed fix by platform
WordPress
- Tools → Site Health flags “The REST API encountered an error”. Check
siteurl/homematch the URL you use, and that.htaccesscontains the standard WordPress rewrite block.
How to diagnose
- REST — Does /wp-json/ return JSON?
- Response — What did the failing request return (DevTools)?
- Blockers — WAF / security plugin logs
- Output — PHP notices or BOM before JSON?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026