
You hit Publish, and instead of your new post going live, WordPress shows: “Publishing failed. The response is not a valid JSON response.” Frustrating — but this publishing failed not a valid JSON response fix guide will get you back on track. The error simply means the block editor sent a REST API request to your server and got something unexpected back — an HTML page, an error, or a blocked request — instead of the JSON confirmation it needs. Here are the causes and six fixes that resolve it.
What Causes “Not a Valid JSON Response”
The Gutenberg block editor communicates with your server through the WordPress REST API using JSON. Every save, publish, and upload action travels through this channel, so anything that corrupts or blocks the response breaks publishing. The most common causes are:
- Security plugin or firewall blocking the REST API: tools like Wordfence, Sucuri, or Cloudflare WAF sometimes mistake the editor’s legitimate REST requests for suspicious traffic and return a 403 instead of JSON.
- Broken permalinks or .htaccess rules: bad rewrite rules or a missing/corrupt
.htaccessfile can make/wp-json/return a 404 HTML page instead of JSON data. - Plugin or theme conflict: a misbehaving plugin can inject output (PHP warnings, blank lines before headers) into the REST response, corrupting the JSON.
- Expired login session: if your login cookie expired, the REST request may return a login page — HTML, not JSON.
- Browser, VPN, or ad-blocker interference: privacy extensions, corporate filters, and VPN security features can intercept REST requests.
- Server caching REST responses: aggressive Nginx FastCGI or page caching can serve stale, cached
/wp-json/responses with broken authentication nonces.
How to Fix “Publishing Failed: Not a Valid JSON Response”
First, quickly test whether the REST API itself works: visit yoursite.com/wp-json/ in your browser. If you see structured JSON data, the API is alive and the problem is elsewhere; if you see a 404, a redirect, or an HTML error page, the endpoint is blocked. More WordPress debugging walkthroughs live on the KamiWeb blog.

- Re-login and retry. Open your wp-admin in a new tab and refresh. If WordPress asks you to log in again, your session had expired — log in and try publishing again. This alone fixes a surprising number of cases.
- Temporarily disable your security plugin/firewall. Deactivate Wordfence, Sucuri, or any WAF plugin and retry publishing. If it works, check the firewall logs to see which REST request was blocked, then whitelist legitimate
/wp-json/traffic instead of leaving protection off. - Inspect the failed request in DevTools. Open your browser’s Developer Tools → Network tab, click Publish again, and look at the failed
wp-jsonrequest. A 401/403 points to authentication or a security rule, 404 to a permalink/rewrite problem, and 500/503 to a PHP or server error. The response body often shows exactly what’s wrong (an HTML page, a firewall message, a PHP error). - Regenerate permalinks and check .htaccess. Go to Settings → Permalinks and click Save Changes (no changes needed) to flush rewrite rules. Then confirm your
.htaccesscontains the standard WordPress rewrite block. If it’s missing or corrupt, replace it with a fresh default.htaccess. - Deactivate plugins and switch themes. Deactivate all plugins, retry publishing, then reactivate one by one to find the culprit. If plugins are clean, temporarily switch to a default theme (Twenty Twenty-Four or similar) to rule out theme interference.
- Raise PHP memory and exclude the REST API from cache. Add
define('WP_MEMORY_LIMIT', '256M');towp-config.php— low memory causes incomplete REST responses. If you use Nginx FastCGI cache, exclude/wp-json/from caching (if ($request_uri ~* "/wp-json/") { set $skip_cache 1; }) so nonces aren’t served stale. If you’re still stuck, explore our free web tools and reach out to your host with the DevTools response details.
Conclusion
The publishing failed not a valid JSON response fix is a process of elimination: confirm the REST API is reachable at /wp-json/, rule out an expired session and security-plugin blocks, inspect the failed request’s status code, then fix permalinks, plugin conflicts, memory, or caching. In almost every case, one of these six steps restores publishing. Find more WordPress resources at KamiWeb.
