So you’re writing a new post in WordPress and you very quickly see this invalid JSON response message the first time the post tries to autosave:
You might think nothing of it or assume it’s not an important error warning, so you go ahead and finish writing a lengthy post. You save it as far as you know, then come back to it later ready to publish and it’s gone.
This potentially extremely frustrating error can cost you a lot of work and time. Fortunately it’s an easy fix, so let’s talk about how to fix an invalid JSON response in WordPress.
Invalid JSON Response – How to Fix It
An invalid JSON response message essentially means that there’s a disconnect in the communication between your site and its server.
There are many different causes to trigger this response, so let’s go through each one.
Permalink Issues
Your site’s permalinks dictate the URL structure of your entire site.
Sometimes the quickest fix for resolving an invalid JSON response is to go to your site’s “Settings”, selecting “Permalinks”, and clicking “Save Changes” without making any changes.
If the permalink structure has changed from what it should be, set it back to what it should be and click “Save Changes”. This can fix your site’s .htaccess file which can be causing the communication issue.
If this still hasn’t worked, log into your site’s hosting account’s cPanel and go into the File Manager.
Delete the .htaccess file (while copy any unique information to it you might have created in it before), then click “Save Changes” in your Permalinks to create a new .htaccess file which should resolve the JSON error if it’s permalink related.
WordPress Site Address Settings
Another cause of the miscommunication which generates the invalid JSON response stems from a problem in your site’s address settings in WordPress.
In the “General” section of your WordPress settings, you’ll see two fields near the top for your site’s URL address and its WordPress address. If either if these is different from the other, then update them to be identical.
Both of these should begin with HTTPS (assuming you have an SSL certificate) and should feature the same prefix of either WWW or without WWW.
Getting these on the same page can resolve the JSON issue, as well.
Plugin/Theme Issues
Lastly, a very common cause of the invalid JSON response message is a conflicting plugin.
In my most recent case, I had an issue with the W3 Total Cache plugin on one of my sites after migrating it to a new host (see how to transfer web hosting from one company to another).
Caching plugins affect your site’s .htaccess file because they instruct browsers in how to engage with your site.
I say this to establish that if the previous tips on fixing your site’s .htaccess file didn’t work, it could be due to a plugin (or theme if it has access to make changes).
This is the very plugin I’d try disabling before trying to replicate the error in creating a new post.
I swapped out W3 for another caching plugin on my site and just like that it was able to begin autosaving again and the JSON message disappeared.
Invalid JSON Response Tips
- An invalid JSON response message indicates a disconnect between your site and its server.
- There are a few different causes of this error, so try them one by one, then try replicating the error to see if the fix(es) worked.
- First try clicking “Save Changes” on your site’s permalinks structure in WordPress even if you see that it hasn’t been changed from what it should’ve been.
- If this doesn’t work, try deleting your .htaccess file via your site’s host’s File Manager (copying any unique data you need from it) and clicking “Save Changes” in permalinks again to generate a fresh .htaccess file.
- Check your site’s listed URL addresses in the general settings. Make sure that they match one another (http vs https, www or not) and update if not.
- Like with so many errors in WordPress, oftentimes they can stem from a conflict from a plugin. Caching plugins in particular can cause these errors due to their control over the .htaccess file, so try disabling yours first and try replicating the error.