Few WordPress errors are as confusing as “Publishing failed. The response is not a valid JSON response.” You click Publish or Update, expecting your post to go live, and instead WordPress gives you a message that sounds more like a developer problem than a content editing issue. The good news is that this error is usually fixable with a practical checklist, even if you are not comfortable editing code.
TLDR: This error usually happens when the WordPress block editor cannot communicate properly with your site through the REST API. Common causes include permalink issues, security plugins, mixed HTTP/HTTPS settings, broken redirects, or server rules blocking requests. For example, if a site was recently moved from http:// to https://, WordPress may still try to save content through the wrong URL, causing the JSON response to fail. In many cases, simply resetting permalinks or fixing the Site Address URL resolves the issue within minutes.
What Does “Not a Valid JSON Response” Mean?
WordPress uses the REST API to send and receive information when you work in the block editor. When you save a post, WordPress expects the server to return data in a specific format called JSON. If the server returns something else, such as an HTML error page, a login screen, a redirect, or a security warning, WordPress cannot understand it and shows the JSON error.
In simple terms, the editor asks your website, “Did this post save correctly?” Instead of receiving a clean answer, it receives a garbled or unexpected response. That is why the problem may appear during publishing, updating, uploading images, or saving drafts.
1. Reset Your WordPress Permalinks
The easiest fix is often to refresh your permalink structure. Permalinks control how WordPress creates URLs, and if the rewrite rules are outdated or corrupted, REST API requests may fail.
- Go to Settings > Permalinks in your WordPress dashboard.
- Do not change anything unless you want to.
- Click Save Changes.
This forces WordPress to regenerate its URL rules. After saving, return to your post and try updating or publishing again. This simple step fixes the issue surprisingly often, especially after migrations, plugin changes, or server updates.
2. Check Your WordPress Address and Site Address
A mismatch between your site URLs can break communication between the editor and the REST API. Go to Settings > General and look at these two fields:
- WordPress Address (URL)
- Site Address (URL)
Both should usually match and use the correct protocol. If your site uses SSL, both should begin with https://, not http://. A common problem occurs when a website is switched to HTTPS, but one of these settings still uses HTTP. That can cause redirects or blocked requests, resulting in an invalid JSON response.
If the fields are greyed out, they may be defined in your wp-config.php file. In that case, you may need to ask your hosting provider or developer to check them.
3. Troubleshoot Plugin Conflicts
Plugins are one of the most common reasons for this error. Security plugins, firewall tools, caching plugins, and optimization plugins can accidentally block REST API requests or change server responses.
To test for a plugin conflict:
- Temporarily deactivate all plugins.
- Try publishing or updating your post again.
- If the error disappears, reactivate plugins one by one.
- Test after each activation until the error returns.
Once you identify the problematic plugin, check its settings. Look for options related to the REST API, firewall rules, JSON, XML-RPC, admin security, or caching. Sometimes, changing one setting is enough. If not, contact the plugin developer or consider replacing it.
4. Temporarily Switch to a Default Theme
Although plugins are more likely to cause this problem, themes can also interfere with REST API behavior. A theme may contain custom code that changes headers, redirects requests, or outputs unexpected content.
To test this, switch temporarily to a default WordPress theme such as Twenty Twenty-Four or another official theme. Then try saving your post again. If the error disappears, your theme may need an update or code review.
Tip: If you are working on a live site, use a staging environment whenever possible. That lets you test plugins and themes without affecting visitors.
5. Check for Mixed Content and SSL Problems
If your site uses HTTPS, all important resources should load through HTTPS as well. Mixed content happens when some files or requests still use HTTP. This can cause browsers or servers to block requests, including ones used by the block editor.
Start by opening your site in a browser and clicking the padlock icon in the address bar. If you see warnings about insecure content, your SSL setup may need attention. You can also use your browser’s developer tools to inspect console errors while saving a post.
Common SSL-related fixes include:
- Updating all internal links from HTTP to HTTPS.
- Installing or renewing your SSL certificate.
- Fixing redirects so HTTP consistently redirects to HTTPS.
- Updating CDN or caching settings to use HTTPS.
6. Review Your .htaccess File
On many Apache servers, WordPress relies on the .htaccess file to manage redirects and rewrite rules. If this file is corrupted or contains conflicting rules, WordPress may return an invalid response to the editor.
You can regenerate the default WordPress rules by saving permalinks, but if you are comfortable using FTP or your hosting file manager, you can also inspect the file manually. A standard WordPress .htaccess file usually contains a block of rules between # BEGIN WordPress and # END WordPress.
Be careful when editing this file. A tiny mistake can make your site unavailable. Before changing anything, download a backup copy. If you are unsure, ask your hosting provider to check whether rewrite rules or redirects are interfering with the REST API.
7. Test the REST API Directly
You can check whether the REST API is working by visiting this URL in your browser:
https://yourdomain.com/wp-json/
Replace yourdomain.com with your actual domain. If the REST API is working, you should see structured text that looks like JSON. If you see a 404 page, a security block, a login page, or a redirect loop, you have found the general source of the problem.
WordPress also includes a Site Health tool. Go to Tools > Site Health and look for REST API warnings. This screen often provides useful clues, such as loopback request failures or blocked connections.
8. Check Your Firewall, CDN, or Hosting Security
Some firewalls and CDN services block requests that look unusual. Unfortunately, legitimate WordPress REST API requests can sometimes be mistaken for suspicious traffic. Hosting security systems may also block certain methods, such as POST requests, which WordPress needs to save content.
If you use a CDN, web application firewall, or advanced hosting security, check the logs for blocked requests around the time you tried publishing. Ask your host whether requests to /wp-json/ are being restricted. A good hosting support team can usually identify this quickly.
9. Increase PHP Memory and Check Server Errors
Sometimes the editor receives an invalid JSON response because the server hits a PHP error or memory limit while saving the post. This is more likely on large pages, sites with many plugins, or posts containing complex blocks.
You can check server error logs through your hosting dashboard. Look for errors that appear at the exact time the publishing failure occurs. Messages about memory limits, fatal PHP errors, or permission problems are especially relevant.
If memory is the issue, increasing the PHP memory limit may help. Many WordPress sites run more smoothly with at least 256 MB of memory, although the ideal amount depends on your setup.
Final Checklist
If you want the fastest path to fixing the error, follow this order:
- Save permalinks under Settings > Permalinks.
- Confirm site URLs use the correct HTTPS address.
- Deactivate plugins and test for conflicts.
- Switch themes temporarily to rule out theme code.
- Test /wp-json/ to confirm REST API access.
- Check firewall and hosting logs for blocked requests.
The “Publishing failed” JSON error may look technical, but it is usually a communication problem between WordPress and your server. Start with the simple fixes, especially permalinks and URL settings, before moving into plugins, SSL, firewalls, and server logs. With a methodical approach, you can usually get the block editor publishing normally again without rebuilding your site or losing content.