Fix Response is Not a Valid JSON Response Error in WordPress

Are you getting the “Updating failed. The response is not a valid JSON response” error while using the WordPress block editor?

It’s a common WordPress error that might arise on your site for a number of causes, including plugin and theme conflict, SSL certificate or mixed content issues, .htaccess file corruption, and so on.

It’s frustrating to get the JSON response error. It doesn’t tell you why it’s happening or how to fix it. Instead, it forces you to stop what you’re doing and find out how to resolve the issue on your website.

Fortunately, the solution is easy.

In this article, we’ll show you how to easily fix the “response is not a valid JSON response” error in WordPress. We’ll also talk about what caused the error on your site and how to fix it.

What Causes the “Response is Not a Valid JSON Response” Error in WordPress?

When you upload an image to your WordPress website or publish or update a post, WordPress sends the request to your web server. The server returns results in JSON format.

If the server does not respond in JSON format or does not respond at all, WordPress throws the “The response is not a valid JSON response.” error.

You’re probably wondering what’s causing the miscommunication or lack of connection between your website and the server.

The answer is that there are several causes. It might be a fault in a plugin or theme, an SSL certificate issue, .htaccess file corruption, a REST API incompatibility, or something else.

That said, let’s look at how to fix the invalid JSON response error in WordPress.

Fix the “The Response is Not a Valid JSON Response” Error in WordPress

Since we don’t know what is causing the problem on your site, trying different solutions is the best way ahead.

But, before we begin, make a backup of your complete WordPress website.

In this guide, you will need to make changes to your website. This is a high-risk business. It can damage your website. A backup will allow you to restore the site to its original state when something goes wrong. As a result, before you begin, backup your WordPress site.

Now, let’s begin with the solutions:

1. Check Your WordPress Site URL

First, double-check that your WordPress Address and Site Address URL are correct.

Simply go to the Settings » General page. From here, go over the WordPress Address (URL) and Site Address (URL) fields.

WordPress URL Settings

For most websites, the URL in both fields must be the same.

However, in some cases, users may have given WordPress its own directory and served the website from a different URL. In such a case, they might have different URLs here.

However, if your Site Address is incorrect, WordPress will give the invalid JSON error.

If you make any changes to the settings, don’t forget to save them by clicking the Save Changes button. You may now edit a blog post to check if adding new blocks or saving the post causes the “Not valid JSON response” error.

If you are still getting the error, then continue reading.

2. Fix the WordPress Permalink Structure

WordPress has an SEO-friendly URL structure, allowing you to create human-readable URLs for your posts and pages.

However, a user may often mess up the permalink settings. This would make it difficult for the WordPress editor to get a valid JSON response, resulting in the error.

To fix this, go to Settings » Permalinks. From here, you must carefully review the permalink options.

WordPress Permalink Settings

If you are unclear whether you are using the correct settings, simply choose one of the available default formats.

After that, click the Save Changes button to save your settings.

You may now try editing a blog post or page to check whether the error has gone away. If it hasn’t, proceed to the next step.

3. Regenerate WordPress .htaccess File

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

Normally, WordPress can regenerate and update it automatically. You may also force the update by clicking the Save Changes button at the bottom of the Settings » Permalinks page.

However, it is sometimes not updated or contains incorrect settings. This would impact your WordPress permalinks and may result in an invalid JSON response error.

To fix this, connect your website through an FTP client in your WordPress hosting account dashboard.

Once connected, find the .htaccess file in the root folder of your website and save it to your PC as a backup.

After that, you must edit the .htaccess file using an FTP client.

Edit .htaccess File

Once the file is open, delete all of the code inside and replace it with the following:

# BEGIN WordPress 
RewriteEngine On 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
RewriteBase / 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
# END WordPress

Don’t forget to save your changes and re-upload the file to your website.

You may now go to your website and edit a post or page to check if you can reproduce the invalid JSON response error.

If the error remains, you may do a few more things.

4. Deactivate All WordPress Plugins

WordPress plugins can occasionally conflict with each other or with the WordPress core. This might cause unexpected behavior and be one of the causes of the invalid JSON error.

Go to the Plugins » Installed Plugins page. Select all of your WordPress plugins and then select Deactivate from the Bulk Actions drop-down option. Now, click on the Apply button.

Deactivate All WordPress Plugins

WordPress will now deactivate all of your installed plugins.

You can now try to reproduce the error once again. If the error goes away, it means that one of the plugins installed on your website was to blame.

To discover which plugin is causing the problem, you need to activate each one individually and then try to reproduce the error. Repeat this process until you find the culprit.

After that, you can contact the plugin’s author for support or look for a different plugin.

5. Look for REST API conflicts

The invalid JSON response error also indicates that the WordPress REST API on your website encountered a problem.

The REST API is a collection of techniques used by WordPress to communicate with the server when working on your website.

You may find details about this error in the WordPress Site Health tool. Go to the Tools » Site Health page.

Rest API Issue in WordPress

From here, you may see an issue labeled The REST API encountered an unexpected result.

By clicking on it, you will get further information that may help you figure out whether a plugin or third-party service is causing the problem.

If this does not give a clue, go to the next step.

6. Disable the Security Firewall

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

The quickest way to resolve this is temporarily disabling your WordPress firewall plugin or service. If the editor begins to work, the firewall is the cause of the issue.

If your firewall is configured at the host level, you may ask your WordPress provider to check and whitelist the editor to prevent it from triggering the firewall. However, If you use a WordPress security or firewall plugin, you can opt to:

  • You can replace your current firewall plugin with a new plugin that secures your site without creating issues.
  • You can contact the plugin’s developer and ask about whitelisting.

7. Use Debugging in WordPress

WordPress allows you to keep an error log, but it is disabled by default. To enable it, add the following code snippet to your wp-config.php file.

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

Once you’ve inserted the code, WordPress will keep a log of any errors in a file called debug.log. You may access this file within the /wp-content/ folder using an FTP client. The error log might provide a hint and help you resolve the invalid JSON issue on your site.

8. Upload Media Files Through the Media Library

Suppose you get the “The response is not a valid JSON response” error while uploading media files using the Block Editor. In that case, one solution is to submit the images directly to your Media Library rather than through the block interface.

When you add an image block, select the Media Library option instead of just clicking the Upload button and upload files from there.

You’ll see the standard WordPress Media Library uploader interface when you do this, which should allow you to skip the invalid JSON response error.

WordPress Media Library

9. Switch to Classic Editor

If all of the above methods fail, you can temporarily switch to the Classic Editor for WordPress.

This older version of the WordPress editor uses a simpler text editor and does not rely mainly on the REST API to get JSON responses.

To use it, you must first install and activate the Classic Editor plugin. See our step-by-step guide on how to install a WordPress plugin.

Classic Editor WordPress Plugin

As soon as the plugin is activated, the Gutenberg editor is disabled by default.

You may now continue working on your website and return to troubleshooting later.

10. Look for Expert Help

Finally, if everything else fails, it might be due to configuration errors on your WordPress hosting server. Most reputable WordPress hosting companies can help users with common WordPress issues like these.

Simply contact them via live chat or a support ticket, and they may be able to assist you.

Fixing the WordPress Invalid JSON Response Error for Good

Seeing an “Updating failed. The response is not a valid JSON response” error can be annoying because it occurs while you’re trying to work in the WordPress editor.

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

In most cases, simply resaving your WordPress permalinks should resolve the issue. If it doesn’t work, you may need to look into other options, such as checking your site URLs, adjusting your firewall, etc. Implement these quick fixes, and your site should be back to normal in no time.

We hope with the help of our article; you were able to fix the JSON response error from your site.

To fix other common WordPress errors, check out these articles:

Lastly, follow us on Twitter for regular updates on new articles.