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).
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
- How to Disable the ModSecurity & Fix the Error
- Other Solutions
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.
- How to Show Last Updated Date on WordPress Posts
- Solved: The Server You’re Connected to is Using a Security Certificate
- How to Enable Optional Module Imagick on cPanel | WordPress
- 403 Forbidden Access to this Resource on the Server is Denied!
- Rest API did not Behave Correctly | Fix WordPress Block Editor
- How to Fix Your Sitemap Appears to be an HTML Page | GSC