Fixed: Updating failed. The response is not a valid JSON response

Updated:

by

How to fix Updating failed. The response is not a valid JSON response on WordPress.

Are you getting the error, “Updating failed. The response is not a valid JSON response” on WordPress Block Editor? You’re in the right place. In this tutorial, I will guide you on what is the cause of this error and how to fix it.

The error occurs on WordPress Block Editor when when you try to Update/Publish a post, or Add a media file (image/video).

JSON stands for JavaScript Object Notation, commonly used for transmitting data from your website/web-applications to your hosting server where it is stored.

Every time you edit a page or post on your website, WordPress connects to the server to respond, using the JavaScript language in JSON format. If the JavaScript code has an error, WordPress won’t be able to connect to the hosting server and you’ll receive the above error message.

Though there can be many reasons for this error, but one of the most common reasons is ModSecurity (web application firewall). The other reasons can be (1) Wrong URL Settings (2) Your Permalink Structure settings (3) Your Plugins (4) Your Theme (5) The REST API encountered an unexpected result (6) Block Editor.

Following topics will be covered in this post

  1. How to Disable the ModSecurity & Fix the Error
  2. Other Solutions

RELATED

01. How to Disable the ModSecurity & Fix the Error

In this section, I will guide you step-by-step on how to disable the ModSecurity on your cPanel account temporarily in order to troubleshoot the error, “Updating failed. The response is not a valid JSON response“.

What is ModSecurity & Why It is Important?

ModSecurity is an Apache module that works as a web application firewall. It blocks known exploits, malicious threats, and provides protection from a range of attacks against web applications. However, sometimes, mod_security may incorrectly determine that a certain request is malicious, while it is actually legitimate.

Disabling the ModSecurity is not recommended. Instead of completely disabling the ModSecurity, you can whitelist the triggered mod_security rule on the server, so that you can bypass the block.

How to Whitelist the Triggered Mod_Security Rule?

If your website is hosted on the shared hosting you might not be able to whitelist the triggered mod_security rule on the server by yourself. But don’t worry! Contact your hosting support and ask them to whitelist the triggered mod_security for the error, “Updating failed. The response is not a valid JSON response“.

They might ask you for your IP Address. You can use this website IP Web Hosting to get the IP Address.

How to Disable the ModSecurity on cPanel

Follow the steps to disable the ModSecurity on cPanel in order to troubleshoot the error.

  • Login to your cPanel account.
  • Scroll-down to SECURITY section and click on the ModSecurity.
  • Turn-off the Status of your domain to disable the ModSecurity.

Now open one of your blog post in the WordPress Block Editor and click on the Update button. If the error, “Updating failed. The response is not a valid JSON response” is removed you have found the cause of the error.

Enable the ModSecurity on your cPanel account again because it is not recommend to disable the ModSecurity. Open a blog post in the WordPress Block Editor and click on the Update button. If the error appears again, contact your hosting support and ask them to whitelist the triggered mod_security for the error.

02. Other Solutions

If disabling the ModSecurity doesn’t work, try these solutions:

  • Check URL Settings
  • Fix Permalink Structure settings
  • Regenerate the .htaccess file
  • Disable your plugins temporarily to find if there is any conflict
  • Disable your active theme temporarily and activate the builtin WordPress theme
  • Go to your Site Health and check whether it is showing the warning, The REST API encountered an unexpected result.”

In order to read more about these solutions, you can go through these tutorials:

If you like this post then don’t forget to share with the other people. Share your feedback in the comments section below.

Download Website themes

Also Read

Related Topics: , , ,
Buy Domain and Hosting on Namecheap Now
Rank Math Best SEO WordPress Plugin Download
Download Website Themes
Mangools SEO Tools
Order Motivational T-Shirts With Quotes from Our Store Fire Ram 23.4.

Subscribe to Our Newsletter!

Leave a Reply

Your email address will not be published. Required fields are marked *