Get AI SEO for FREE.

Learn More!
How to Fix the Invalid JSON Error in WordPress

How to Fix the Invalid JSON Error in WordPress

84 / 100

Have you ever tried to upload a file or modify a piece of content on your WordPress site and been greeted by a frightening red notification that reads, “Updating failed. The response is not a valid JSON response“.

This invalid JSON error usually occurs when you update or edit your posts in WordPress. While working, getting this error message can disrupt your editing and sometimes be annoying.

Don’t worry — while this message might seem ominous, there are some easy fixes to prevent this issue from happening in the future.

In this article, we’ll discuss the causes of this error and how to fix it easily.

Fix the Invalid JSON Error – Video Tutorial

Don’t want to read? You can learn how to fix the Invalid JSON error on your WordPress site with our video tutorial.

How to Fix the Invalid JSON Error in WordPress?

What Triggers ‘Not a Valid JSON Response’ Error in WordPress?

The error “Updating failed. The response is not a valid JSON response” usually occurs while you’re working on your content in the WordPress Block Editor. It may also occur when you try to add a media file to your site, particularly if you submit it directly to a block in the block editor.

Updating failed. The response is not a valid response error message

So, what causes this to happen?

When you edit a website page or post, it connects to the server to respond. Your website uses JavaScript to send this response in JSON format. If your JavaScript code has an error and WordPress cannot connect to the hosting server, you will receive this error message.

In simple words, if the editor can’t communicate with the server, it will show you the error. The error could appear due to various reasons, most likely due to incorrect URL settings or broken permalinks.

With that being said, let’s take a look at how to fix the invalid JSON error in WordPress.

Before we begin, we highly recommend you take a backup of your site so that if something goes wrong, you can undo all the changes and restore your site to the previous state.

How to Fix The “Updating Failed. The Response is Not a Valid JSON Response” Error in WordPress

Now that you’re aware of what an invalid JSON response error message means error let’s look at some troubleshooting methods to fix this error message.

1 Check the URL Settings of the WordPress Site

One of the common causes of this error is incorrect URL settings. If you accidentally put HTTP instead of HTTPS (assuming your site is using an SSL certificate), it results in a mixed content error where both HTTP and HTTPS content is transmitted at the same time to the web browser. Hence you’re bound to get this error message.

To fix the error, you need to ensure that your WordPress Address and Site Address settings are correct. You can check these settings by navigating to Settings → General from your WordPress dashboard, as shown below.

Check the URL settings to fix updating failed. the response is not a valid json response Error in WordPress.

If you’ve made any changes to this page, don’t forget to save them by clicking on the Save Changes button. You can now edit a blog post and see if adding any new blocks or saving the post triggers the error. 

WordPress permalinks are the unique URLs for each of your posts and pages. However, there are chances you might mess up with the permalink settings. The WordPress editor will not receive a valid JSON response and cause the error to appear in such a case.

To fix this, navigate to Settings → Permalinks from your WordPress dashboard and ensure that the correct permalink setting is selected. If you’re not aware of using the right settings, select the default permalink settings and click on the Save Changes button.

Fix the permalink structure

Once you’ve fixed the permalink settings, try editing your post to see if it has fixed the error.

3 Regenerate WordPress .htaccess File

In WordPress, the .htaccess file is utilized as a configuration file to manage SEO-friendly URLs (permalinks).

WordPress can normally regenerate and update the file on its own. The update can also be triggered by clicking the Save Changes button at the bottom of the Settings → Permalinks page.

However, it is possible that the settings will not be updated or might be inaccurate. Hence, your WordPress permalinks would be affected, and you’ll still notice the error. You can then make sure your .htaccess file is clean by deleting it and forcing WordPress to create a new one.

To fix this, use an FTP client or the file management software in your WordPress hosting account dashboard to connect to your website. Once you’ve connected, look for the .htaccess file in the root folder. Make a backup copy of the file on your computer.

Download .htaccess file

Delete the file from the server. Now, navigate to Settings → Permalinks from your WordPress dashboard. Then, make sure the permalink option of your choice is selected, and then click on the Save Changes button. This will create a new clean .htaccess file for your website. Now check if the error “Updating failed. The response is not a valid JSON response” is resolved on your site.

4 Check the Themes and Plugins

If the above methods don’t work, you can determine whether a theme or plugin causes the problem. So, from your WordPress dashboard, navigate to Appearance → Themes. Then activate the default WordPress theme and see if the problem has been resolved. If this isn’t the case, go back to your old theme.

The error can be caused by a plugin, in which case you need to disable all plugins on your site and check again to see if the error persists. To do so, navigate to Plugins → Installed Plugins from your WordPress dashboard. Select all your WordPress plugins and choose the Deactivate option from the Bulk Actions drop-down menu, and click Apply button as shown below.

Deactivate plugins to fix 'Updating failed. The Response is Not a Valid JSON Response' error

If the error does not appear, the problem is likely due to a plugin.

To figure out which plugin is causing the issue, perform the below steps:

  • Turn on each plugin separately and see if the error occurs.
  • If the error persists after you enable a particular plugin, you’ll know which one is causing the error.
  • You can then deactivate that plugin and activate the remaining plugins. You can further reach out to the plugin author for support or look for an alternative plugin. 

5 Use Classic Editor

WordPress upgraded its Classic Editor in December 2018 to the new Gutenberg/Block Editor. Since then, many users have encountered this problem. Hence, you can switch to the Classic Editor to solve the error. At first, you need to install and activate the Classic Editor plugin.

If you use the Classic Editor, the new Block Editor of WordPress will be replaced by the old Classic Editor. This will alter how you edit your pages and posts in the future. This may also impact the formatting and layout of existing pages and posts previously changed with the Block editor.

As a result, you should first secure your site by changing a setting in the Classic Editor before using it. Once you’ve activated the Classic Editor, navigate to Settings → Writing from your WordPress dashboard. From here, select Classic editor as the default editor for all users.

 switch to classic editor

You can also select the Yes option and allow users to switch editors. This will allow you to utilize the Gutenberg/Block editor on your current pages and posts, so you won’t have to worry about losing work if you want to change any of your existing pages or articles. Save your changes and try editing the post to see if the error is resolved.

6 Check the Site Health

WordPress provides improvement recommendations for your website by showing the health of your site. To check the site’s health, navigate to Tools → Site Health page as shown below.

Check site health

You can check if WordPress REST API on your website encountered an error. To do so, look for a heading such as “The REST API encountered an unexpected result.” If you find this issue, solving the issue might fix the JSON response error for your website.

7 Disable the Security Firewall

If you use a firewall to secure your WordPress site, it may cause the editor’s connection with your server to be disrupted, resulting in the “Updating failed. The response is not a valid JSON response” error.

The simplest approach to sort this out is to disable your WordPress firewall plugin or service for a while. If the editor starts working, the firewall is the cause of the error.

If your firewall is set up at the host level, you can ask your WordPress provider to look into it and whitelist the editor to prevent it from triggering the firewall. If you are using a WordPress security or a firewall plugin, you can choose to:

  • Replace your current firewall plugin with a new one that helps secure your site without causing issues.
  • You can contact the plugin’s developer to help you solve the error.

8 Use Debugging in WordPress

WordPress allows you to keep a log of errors, but it’s not enabled by default. To enable it, add the following code snippet in your wp-config.php file.

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

Once you’ve added the code, WordPress will maintain a log of all the errors in a debug.log file. You can access this file inside the /wp-content/ folder through the FTP client. The error log can provide you with a clue and help you solve the invalid JSON error on your site.

9 Upload Media Files Through the Media Library

If you’re still receiving the error when uploading media files through the Block Editor, one solution is to submit the images directly to your Media Library rather than through the block interface.

To do so, when you’re adding an image block, click on the Media Library option.

Select media library option

Then select the file you want to upload and click on the Select button.

upload files through media library

This should resolve the invalid JSON response error. This is a temporary fix, but it can come in handy if you’re in the middle of creating a post or if none of the other methods work.

Also, if you try to upload images containing unsupported characters in the image name, you may get the error “The response is not a valid JSON response.” Naming images correctly is important. As a result, you can only use English letters, numbers, and other symbols like hyphens to rename your image. Once you’ve renamed your images appropriately, upload the image to see if the error has been resolved.

10 Look for Expert Help

If none of the above-listed methods are at your rescue, then the error could be due to a misconfiguration on your hosting server. You can contact the host team either by raising a support ticket or through a live chat, and they may be able to help you fix the issue.

Conclusion

The invalid JSON error can be annoying as it appears while working in your WordPress editor.

Fortunately, debugging this problem shouldn’t be too difficult for most sites.

In most cases, re-saving your WordPress permalinks should solve the issue. If that doesn’t work, you’ll need to look into other options like reviewing your site’s URLs, checking the themes and plugins, modifying your firewall, and so on. Try to implement the troubleshooting methods mentioned in this article, and your site should be up and running in no time.

Which method has worked for you? Let us know by Tweeting @rankmathseo. 💬

Email Icon

Don’t Miss Any Future Post!

Sign up today for Exclusive SEO Articles