Were you trying to upload a file or edit a piece of content on your WordPress site only to be met by a scary red message saying something like, "Updating failed. The response is not a valid JSON response?"
The WordPress invalid JSON response error happens in the new Block Editor (AKA Gutenberg) when something goes wrong on your site. Because it appears when you're working on content, it can be a frustrating error because it can get in the way of whatever task you're trying to accomplish.
Thankfully, there are some straightforward steps that you can take to fix this problem and get your site working properly again.
In this post, we'll briefly explain what the invalid JSON response error means. Then, we'll share a number of troubleshooting steps you can implement to fix the problem.
What causes the WordPress invalid JSON response error?
If you see "Updating failed. The response is not a valid JSON response," it will typically appear when you're working on content in the WordPress Block Editor. In some cases, it can also appear when you're trying to upload a media file to your site, especially if you're trying to upload the file directly to a block in the Block Editor.
So, why does it happen?
When you're working in the Block Editor, the editor is in constant communication with your WordPress site's server. This "communication" happens behind the scenes, but it's important to the editor.
One of the "languages" of this communication is JSON, short for JavaScript Object Notation. If something goes wrong with this communication, WordPress will show the "The response is not a valid JSON response" message. It means that the editor failed to get a response to the server or the response wasn't in a valid JSON format.
Basically, if the editor can't communicate with the server, it will show this error message instead.
To fix the problem, you essentially need to fix whatever is getting in the way of the communication.
How to Fix the WordPress Invalid JSON Response Error
Now that you know what the JSON response error message means, let's dig into some troubleshooting steps to fix this problem.
We'll try to put these in a logical order, so that the first troubleshooting steps are the most likely to fix the problem.
For that reason, we recommend trying these processes in the order that we've written them.
Fix your site's permalinks and .htaccess file.
One of the most common causes of the invalid JSON response error is an issue with your site's .htaccess file and/or WordPress permalinks.
Thankfully, this is also one of the simplest debugging steps. Here's all you need to do:
- Go to Settings → Permalinks in your WordPress dashboard.
- Verify that the correct permalink structure is selected — If the correct structure is already selected, you don't need to change anything.
- Click the Save Changes button. Even if you didn't change anything, you should still click the save changes button because it will force WordPress to regenerate its rewrite rules.
Now, go back to the editor and see if that fixed the invalid JSON response error.
If you're still experiencing issues, you can guarantee that your .htaccess file is clean by deleting it and forcing WordPress to generate a new one. Here's how:
- Connect to your server using an FTP client or cPanel File Manager.
- Find your .htaccess file (it should be in the root folder).
- Download a copy of the file to your computer as a backup (just in case).
- Delete the file from your server.
- Go to Settings → Permalinks in your WordPress dashboard and click Save Changes. This will force WordPress to generate a new, clean .htaccess file.
- Check if the problem is fixed.
Finally, there's one last potential fix, but it really only applies to advanced WordPress users.
If you're working in a local development environment via a tool such as XAMPP, you'll also want to make sure that you've properly configured the .htaccess file permissions and enabled mod_rewrite in Apache's settings. Make sure to restart Apache once you've made the changes.
Check your WordPress site URL.
Another common cause of the invalid JSON response error is a problem with your WordPress site URLs.
The problem can arise if your site URLs aren't correct or if you accidentally put HTTP instead of HTTPS (assuming your site is using an SSL certificate).
To fix this problem, go to Settings → General in your WordPress dashboard.
You'll want to verify two things here:
- Make sure that the URLs are correct. On the vast majority of WordPress sites, your WordPress Address and Site Address should be the same.
- Make sure that both URLs start with https if you're using an SSL certificate on your site.
Then, save your changes.
In very rare cases, your site's URLs might have been hard-coded into your wp-config.php file. If this is so, any changes that you make via your WordPress dashboard won't apply because those hard-coded changes will override the dashboard settings.
Again, this is very rare because you need to manually add those hard-coded changes, but it can happen so it might be worth checking. For example, your WordPress developer might have done this for you without letting you know.
How to Launch a WordPress Website
Learn how to launch a website on WordPress with this step-by-step guide and checklist. Learn how to...
- Set up your domain name.
- Install an SSL certificate.
- Analyze your content.
- Back up your site.
Download Free
All fields are required.
Here's how to check if this is the case:
- Connect to your site's server using FTP or cPanel File Manager.
- Edit the wp-config.php file.
- Search for define( 'WP_HOME' OR define( 'WP_SITEURL'
Here's an example of what it might look like:
If you do find these code snippets, you can either:
- Verify that both site URLs are correct and leave the code snippets in your wp-config.php file.
- Remove the code snippets, which will tell your site to use the URLs that you set in your WordPress dashboard.
Check for a mixed content warning (HTTPS issue).
If your site is using an SSL certificate (which most sites do nowadays), issues with mixed HTTP and HTTPS content can trigger the invalid JSON response error.
In order for your website to benefit from the security of your SSL certificate, you need to use HTTPS to load every resource on your site. If you still have some resources loading over HTTP, this can trigger something called a mixed content warning and which causes problems with the invalid JSON response error.
In the previous section, you made sure that your WordPress site URLs both start with HTTPS (if you're using an SSL certificate), which should fix many problems with mixed content already.
However, there could still be issues, especially if you're using a plugin to handle migrating an older site from HTTP to HTTPS.
If you're using a plugin, make sure that you've fully enabled its mixed content fixer features. You can do this by going to Settings → SSL and enabling both the Mixed content fixer and the Fire mixed content fixer with different method toggles:
If you're not using an SSL plugin, many hosts now offer tools to force HTTPS, which you can find in your hosting dashboard or by consulting your host's documentation.
Finally, if you're using Cloudflare on your site, make sure that you've set its Encryption Mode to Full (Strict) or Full. Try the Strict option first and then switch to just Full if you experience any issues.
Disable your security firewall.
If you use a firewall to protect your WordPress site, this can sometimes interfere with the editor's connection to your server and trigger the invalid JSON response error.
This is especially common with ModSecurity rules from your web host, though it also might be triggered by popular security plugins.
To troubleshoot this, try deactivating your firewall or security plugin and see if that fixes the problem. If the editor starts working, you know that something is going wrong with your firewall.
Of course, leaving the firewall disabled isn't a viable long-term strategy, but you at least now know what's causing the problem and you can start fixing things.
If your firewall is implemented at the hosting level, you can ask your WordPress host to investigate and whitelist the editor to avoid having it trigger the firewall. That way, you can maintain the protection of your site's firewall while still avoiding the invalid JSON response error.
If you're using a WordPress security or firewall plugin, you have two options:
- You can replace your existing firewall plugin with a different plugin that protects your site without causing problems.
- You can reach out to the plugin's developer to ask them about whitelisting to avoid future problems.
If you're using Wordfence (or another plugin that has a "learning mode"), you can also try reactivating learning mode to reset its firewall rules.
Use a classic editor plugin.
Some people report being able to fix the invalid JSON response error by activating and deactivating the Classic Editor (WordPress' old, TinyMCE-based editor).
It only takes a couple of minutes, so it's worth seeing if this trick can fix your problems.
Here's all you need to do:
- Install the official Classic Editor plugin from WordPress.org.
- Go to Settings → Writing and use the drop-down to select the Classic Editor as the default editor for all users.
- Save your changes.
- Use the same drop-down to change the default editor back to the Block Editor.
- Save your changes again.
Now, try creating or editing a new post and see if it works.
Deactivate your WordPress plugins.
Debugging WordPress errors can be tricky because the plugins that you're using introduce a lot of variables to the equation. With 58,000+ plugins at WordPress.org, that's a lot of edge cases that could be triggering the invalid JSON response error.
One easy way to figure out if a plugin is causing the problem is to deactivate all of your plugins.
If you're still seeing the invalid JSON response error after deactivating everything, you can be confident that it's not an issue with your plugins and you can reactivate them.
On the other hand, if the error goes away after deactivating your plugins, you know that there's a problem with one of the plugins that you're using.
To find the problematic plugin, you can reactivate your plugins one by one, making sure to test the editor after each plugin. If you activate a plugin and see the error appear right after that, you've found the issue.
From there, you can either replace that plugin with an alternative that doesn't cause a problem or you can reach out to the plugin's developer for help and a potential fix.
How to Launch a WordPress Website
Learn how to launch a website on WordPress with this step-by-step guide and checklist. Learn how to...
- Set up your domain name.
- Install an SSL certificate.
- Analyze your content.
- Back up your site.
Download Free
All fields are required.
Upload media files via the Media Library.
If you're seeing the "The response is not a valid JSON response" when you try to upload media files via the Block Editor, one fix is to upload these images directly to your Media Library instead of via the block interface.
When you add an image block (or the block for another type of media file), click on the Media Library option and upload files that way instead of just clicking the Upload button.
When you do that, you'll see the regular WordPress Media Library uploader interface, which should let you bypass the invalid JSON response error.
Check the console and debug log.
For more advanced users, you can try digging into your browser's console or various debug logs to find a more specific problem. This isn't really a solution for casual users, though, as you'll need some technical knowledge to accomplish anything here.
First off, you can use the Network tab in Chrome Developer Tools to find issues with Ajax calls.
In the Network tool, select FETCH/XHR to filter out Ajax calls and debug issues with the REST API.
You can also view some REST API issues from your WordPress dashboard. Go to Tools → Site Health and look for a heading such as "The REST API encountered an unexpected result".
Use the Classic Editor as a short-term fix.
This last method isn't a permanent fix, but it is a workaround that can help you publish content in a pinch.
Earlier, we told you about the Classic Editor trick where you switch your site to the Classic Editor but then switch back to the Block Editor.
Well, if none of the other tips have worked for you, one way to continue publishing content is to just leave the Classic Editor enabled and use that to create content for the time being.
This isn't an actual "fix" because you'll lose all of the functionality that the Block Editor adds. However, it will give you the ability to work on content while you continue debugging the "The response is not a valid JSON response" message.
Additionally, once you get the Block Editor working again, you'll be able to convert your Classic Editor content into blocks with just a few clicks.
Fixing the WordPress Invalid JSON Response Error
Seeing a "Updating failed. The response is not a valid JSON response" message can be frustrating because it appears while you're trying to work in the WordPress editor.
Thankfully, for most sites, debugging this error shouldn't be too painful.
In most situations, simply re-saving your WordPress permalinks should fix the problem. If that doesn't work, you might need to dig into other fixes such as checking your site URLs, fixing mixed content warnings with HTTPS, adjusting your firewall, and more. Implement these troubleshooting steps and you should have your site functioning properly again in no time.