Are you experiencing the ‘Not a Valid JSON Response’ error in WordPress? This error often appears when you’re editing posts or pages.
Unfortunately, when you encounter the message, ‘Updating failed. The response is not a valid JSON response.’ Often, it’s not clear what’s causing this problem or how to resolve it.
But don’t worry! We have got you covered.
In this Gutenberg editor WordPress tutorial, we will walk you through multiple effective solutions to fix the ‘Not a Valid JSON Response’ error in WordPress. We will also discuss why this error happens and how to prevent it in the future.
Ready? Let’s jump right in!
Why Does ‘Not a Valid JSON Response’ Error Happen in WordPress?
When you edit a post or page, WordPress sometimes fails to receive the expected response from the server, which in turn causes a ‘Not a Valid JSON Response’ error.’
Basically, when you edit a blog post, WordPress communicates with the server in the background, and this communication relies on receiving responses in JSON format.
JSON (JavaScript Object Notation) is a lightweight data-interchange format that’s easy for both humans and machines to read and write.
For some reason, when WordPress doesn’t get a response in the proper JSON format, or if it doesn’t receive any response at all, then you see the ‘Not a Valid JSON Response’ error message.
The unfortunate reality is that this error can occur for a number of different reasons. Common causes include incorrect URL settings in your WordPress configuration or broken permalinks. Server misconfigurations, plugin conflicts, or issues with the REST API can also trigger this error.
Now, let’s explore the solutions that can help you effectively fix the ‘Not a Valid JSON Response’ error in WordPress.
List of 10 Easy Ways to Fix the ‘Not a Valid JSON Response’ Error in WordPress
Follow each method to fix the ‘Not a Valid JSON Response’ error. If it persists, move on to the next one.
Solution #1: Correct Permalink Structure in WordPress
WordPress offers an SEO-friendly URL structure, which enables you to create human-readable URLs for posts and pages.
However, incorrect permalink settings can prevent the WordPress block editor from receiving a valid JSON response, thus resulting in the ‘Updating failed. The response is not a valid JSON response.’ error.
To resolve this, go to Settings → Permalinks. Carefully review the permalink options available.
If you’re unsure about the correct settings, select one of the default formats. After making your selection, click the ‘Save Changes’ button to apply your settings.
Now, you can edit a post or page to see whether the error has been fixed. If the error persists, proceed to the next solution.
Solution #2: Manually Update the .htaccess File in WordPress
The .htaccess file in WordPress specifies SEO-friendly URLs (permalinks).
Usually, WordPress updates this file automatically. You can also update the .htaccess file by clicking the ‘Save Changes’ button on the Settings → Permalinks page.
Unfortunately, oftentimes, the .htaccess file does not update correctly or contains incorrect settings. This can affect your permalinks and cause the ‘Not a Valid JSON Response.’
To fix this, you will need to connect to your website using an FTP client or the file manager app in your WordPress hosting account dashboard.
To fix this, connect to your website using an FTP client or the file manager in your hosting account dashboard.
Then, locate the .htaccess file in your website’s root folder and download it as a backup.
Next, open the .htaccess file using an FTP client or the file manager.
Upon opening the file, delete all the existing code 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
Finally, save your changes and upload the file back to your website. Then, Visit your site and try editing a post or page to see if the error persists.
If the error continues, proceed to the next solution.
Solution #3: Check for URLs in WordPress Settings
Firstly, you have to verify that your WordPress Address and Site Address settings are accurate.
To check that, Go to Settings → General. Here, review the following fields:
- WordPress Address (URL)
- Site Address (URL)
For most websites, both fields should contain the same URL.
However, some users may set up WordPress in its own directory while serving the website from a different address. In such cases, the URLs can differ.
If the Site Address is incorrect, it can trigger the ‘Updating failed. The response is not a valid JSON response.’
After making any necessary changes, don’t forget to click ‘Save Changes.’ to apply the changes. Then, try editing a post to see if adding new blocks or saving the post still triggers the ‘Not a Valid JSON Response’ error.
If the error continues, move on to the next solution.
Solution #4: Switch Back to WordPress Classic Editor
Another option is to switch to the WordPress Classic Editor for a while. This older version uses a simpler text editor and doesn’t rely heavily on the REST API for JSON responses.
To switch, install, and activate the Classic Editor plugin. For detailed instructions, refer to our step-by-step guide on installing the WordPress Classic Editor.
When you activate the Classic Editor plugin, it disables the Gutenberg editor immediately.
Alternatively, you can use the Disable Gutenberg plugin to turn off the Gutenberg editor and activate the Classic Editor. For more information, see our guide on how to disable the Gutenberg Editor in WordPress.
By doing this, you can continue working on your website while troubleshooting the ‘Updating failed. The response is not a valid JSON response’ issue later.
Solution #5: Enable WordPress’ Debugging Feature
WordPress has a built-in feature for logging errors, but it is not enabled by default.
So, to activate it, add the following code to your `wp-config.php` file:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
Once enabled, WordPress will record logs of all errors in a `debug.log` file, which you can find inside the `/wp-content/` folder. You can also access this file using any FTP client.
By reviewing the error log, you can get a better understanding of what is causing the ‘Not A Valid JSON Response’ error on your website.
Solution #6: Look for the Mixed Content Error
A mixed content error occurs whenever a website served over HTTPS (secure) attempts to load resources (such as scripts, images, or data) from an insecure HTTP source.
Today, most modern browsers block mixed content to prevent security risks, as attackers could inject malicious content into the secure website via the insecure resource.
To resolve this, make sure all resources on your website are loaded over HTTPS. You can do this by updating URLs and using plugins that fix mixed content issues.
Solution #7: Activate WordPress Default Theme
Sometimes, third-party WordPress themes, especially those with bad code or poorly maintained themes, can cause conflicts with the WordPress core or other plugins.
These conflicts might cause errors like the ‘Updating failed. The response is not a valid JSON response’ error.
Thus, switching to a default WordPress theme removes any custom code or functionalities added by your existing theme, which makes it easier for you to identify the issue.
To switch to a default theme, go to Appearance → Themes in your WordPress dashboard. Find a default theme like Twenty Twenty-Four or Twenty Twenty-Three and click ‘Activate.’ This will help isolate the problem and identify if your current theme is causing the error.
Solution #8. Disable Your WordPress Firewall
Some WordPress firewalls, such as Sucuri, Cloudflare, or any other plugin, can sometimes block legitimate requests such as JSON responses.
To find out if the firewall is causing the problem, temporarily disable your WordPress firewall plugin.
- For application-level firewalls, deactivate the plugin in your WordPress dashboard.
- For DNS-level firewalls like Sucuri or Cloudflare, disable them through their respective account dashboards.
This will help you determine if the firewall is causing the ‘Updating failed. The response is not a valid JSON response’ error.
Solution #9: Check REST API Error Logs
If you receive the ‘Not a Valid JSON Response.’ error on your site, there could be a problem with the WordPress REST API.
In WordPress, the REST API enables communication between your site and the web server.
To investigate this, use the WordPress Site Health tool. Go to Tools → Site Health.
Look for any issues labeled ‘The REST API encountered an unexpected result.’
Clicking on this will provide more details and may help identify which plugin or third-party service is causing the problem.
If this doesn’t reveal any helpful information, proceed to the next solution.
Solution #10: Deactivate Every WordPress Plugin
WordPress plugins can sometimes conflict with each other or with the WordPress core software, which can cause unexpected issues, such as the ‘Updating failed. The response is not a valid JSON response.’ error.
To troubleshoot this:
- Go to Plugins → Installed Plugins.
- Select all your plugins and choose ‘Deactivate’ from the ‘Bulk Actions’ drop-down menu.
- Click the ‘Apply’ button to proceed.
Now that you have deactivated all the plugins, simply edit a post or page to see if the error still occurs. If the error disappears, it indicates that one of the plugins was causing the issue.
To identify the problematic plugin, activate your plugins individually, attempting to reproduce the error each time. Continue this process until you find the plugin responsible for the error.
Once identified, you can contact the plugin author for support or find an alternative plugin.
Finally, Contact Your Web Hosting Provider
After applying all of the above solutions, if you are still getting the ‘Updating failed. The response is not a valid JSON response.’ error; then it is likely due to the misconfiguration of your WordPress hosting server.
Fortunately, almost all WordPress hosting companies help users with common WordPress problems.
So, just reach out to them through live chat or a support ticket, and they will likely help you fix this error.
We sincerely hope this article helped you to fix the ‘Not a Valid JSON Response’ error in WordPress.
If you still have any questions, feel free to ask in the comment section below. We would love to help!
Leave a Reply