How to fix the “Updating failed. The response is not a valid JSON response” error
The “Updating failed. The response is not a valid JSON response” error usually happens when the WordPress editor fails to receive a valid response from the server, preventing you from saving or publishing changes.
The issue occurs most often when updating your website content, and can be frustrating if you don’t know how to deal with it.
In this guide, you’ll learn the common causes of this error and the step-by-step solutions to fix it. By the end, your WordPress site will function as always, and your content updates will be applied properly.
Download comprehensive JSON cheat sheet
What causes the invalid JSON response error
The invalid JSON response error appears when WordPress tries to communicate with the server, expecting a valid response, but receives an invalid or unexpected one.
JavaScript Object Notation (JSON) is a data format that transmits information between the browser and the server. This error interrupts the communication process, leading to issues with saving or updating content.
Identifying the root cause of this JSON error is vital to applying the correct fix. Here are some common causes:
- Incorrect site URL settings. Mismatched WordPress site address settings can disrupt JSON responses.
- Plugin conflicts. Incompatible or poorly coded WordPress plugins may interfere with the JSON response.
- Server configuration issues. Server-side problems or insufficient resources can lead to this error.
- SSL/mixed content problems. Mixed content from HTTP and HTTPS elements can prevent proper JSON communication.
- Permalink structure issues. Improper permalink settings can affect how URLs are handled, causing JSON errors.
Ways to troubleshoot the invalid JSON response error
Here are the practical troubleshooting steps to identify and fix the invalid JSON response error. We suggest starting with the first method and moving to the next if the issue persists.
Check your site’s permalink settings
In WordPress, permalinks are the permanent URLs to your posts, pages, and other site content. They define how your URLs are structured and displayed in the browser.
Improper permalink settings can disrupt your website’s URL structure, leading to WordPress errors like the invalid JSON response. Here are the instructions to check and correct your site’s permalinks:
- Log in to your WordPress dashboard.
- In the left sidebar, go to Settings → Permalinks.
- Select a valid permalink structure, such as Post name.
- Even if you make no adjustments, click Save Changes to refresh your permalink settings.
- Try updating or publishing your content again to see if the error is resolved.
Check your WordPress site address
Incorrect site URL settings can also cause the JSON error on your WordPress website. This issue occurs when the WordPress Address (URL) and Site Address (URL) don’t match or are mistakenly configured.
A common cause is when you’ve recently changed your WordPress domain address but didn’t update both fields. This mismatch blocks the editor from receiving a valid JSON response, resulting in the error.
Follow these steps to verify your WordPress site address:
- Access your dashboard and navigate to Settings → General.
- Ensure the WordPress Address (URL) and Site Address (URL) fields match your website’s domain. They should also use the same protocol, either HTTP or HTTPS.
- Click Save Changes to apply the corrections.
Deactivate plugins to detect compatibility issues
Plugin conflicts commonly cause unexpected errors in WordPress, including the invalid JSON response. A poorly coded plugin or incompatible with your current WordPress version may prevent the editor from communicating with the server properly.
Deactivating your plugins can help you identify if one of them is causing the problem. Here’s how to do it:
- From your WordPress dashboard, go to Plugins → Installed Plugins.
- Select all plugins, choose Deactivate from the Bulk actions dropdown menu, and click Apply.
- Update or publish content in the editor again to check if the JSON error persists.
- If the error is resolved, reactivate each plugin individually and test the site after each activation to identify the culprit.
- After identifying the problematic plugin, update it to the latest version, find an alternative, or contact the plugin’s developer for support.
Create a new .htaccess file
.htaccess is a configuration file web servers use to manage various settings, such as redirects, access control, and WordPress permalinks. A corrupted .htaccess file can interfere with WordPress functionalities, leading to an invalid JSON response error.
Creating a new .htaccess file can help resolve the issue by resetting your site’s configuration settings. To do this, access your website’s root folder via an FTP client like FileZilla or your hosting provider’s file manager.
If you host your WordPress site on Hostinger, here are the steps:
- Log in to hPanel with your Hostinger account and go to Websites → Dashboard.
- Click File manager or navigate to Files → File Manager via the dashboard’s left sidebar.
- Double-click the public_html directory to open it.
- Right-click .htaccess and select Rename. Edit it to something like .htaccess_old to back it up.
- Go to your WordPress dashboard and access Settings → Permalinks.
- Click Save Changes to generate a new .htaccess file with default settings automatically.
Fix any WordPress mixed content error
Mixed content occurs when a website loads HTTP and HTTPS elements, which can cause issues with security and functionality.
In WordPress, mixed content can disrupt the editor and server communication because browsers block non-secure requests on a supposedly secure page. Fixing mixed content ensures all elements are loaded securely, resolving potential JSON errors.
Here’s the guide:
- Install a plugin like Really Simple SSL or Better Search Replace. These plugins can detect mixed content warnings in your database and convert HTTP URLs to HTTPS.
- Review your theme files, widgets, images, and other content areas for hard-coded HTTP links and manually update them to HTTPS.
- Clear your WordPress cache using a caching plugin to ensure the new settings are applied correctly. Alternatively, for Hostinger’s WordPress hosting customers, go to Dashboard → WordPress → Overview and hit Flush Cache.
View the REST API debug log
The WordPress REST API enables the editor to communicate with the server and perform tasks like saving and publishing content. If the REST API is blocked or malfunctioning, the editor can’t receive a valid JSON response.
Checking the REST API debug log helps you identify any underlying issues causing this error. Follow the instructions below to view the debug log:
- Access your WordPress site’s root directory via FTP or your hosting provider’s file manager.
- Open the wp-config.php file and add the following code snippets before the “That’s all, stop editing! Happy publishing!” line to enable debugging and logging:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Once done, save your changes.
- Go to your WordPress editor and try updating content to trigger the error and generate log entries.
- Access the wp-content directory in your site’s root folder. Then, find the debug.log file and open it to view the log entries.
- Look for entries related to the REST API in this file. These may provide clues about what’s causing the JSON error, such as SSL certificate problems, server configuration issues, or blocked requests.
Temporarily disable the security firewall
Firewalls protect your WordPress website from malicious attacks by blocking suspicious requests. However, they may also block legitimate requests from the WordPress editor for security reasons, causing errors like the invalid JSON response.
Temporarily disabling your security firewall can determine if it’s the source of the issue. Follow these steps:
- If you use a firewall plugin like Wordfence, Sucuri, or iThemes Security, deactivate it temporarily.
- Users with a web application firewall (WAF) like Cloudflare or AWS WAF can access the WAF website, open the settings, and temporarily disable or set it to “Learning Mode.”
- If your hosting provider has server-level firewalls, access the control panel and turn them off.
- Return to your WordPress editor and try saving or publishing the content. If the error has been resolved, you’ve identified the firewall as the cause.
- Re-enable the firewall and adjust its settings to allow valid requests without blocking them. If you need help with what to do, contact your plugin, WAF, or hosting provider’s support team for assistance.
Alternative ways to get around the invalid JSON response error
While working on resolving the invalid JSON response error, there are temporary solutions to continue updating your content without interruptions. These methods help bypass the problem, providing a workaround until you apply a permanent fix.
Use the Classic Editor plugin
As the name suggests, the Classic Editor plugin lets you use the previous classic editor. It’s less reliant on the WordPress REST API and can help avoid issues with the block editor. Here’s how:
- In your dashboard, go to Plugins → Add New.
- Search for the Classic Editor plugin, install it, and click Activate.
- Once activated, it will replace the WordPress block editor. Try editing your content again to see if the issue is fixed.
Upload media files directly
If the JSON error occurs when uploading images or files in the block editor, you can upload media directly through the media library as a temporary solution:
- Navigate to Media → Add New.
- Upload your files here, then insert them into your posts or pages.
Conclusion
The WordPress invalid JSON response error can arise from several issues, such as incorrect URL settings, plugin conflicts, or server configuration problems.
This article has provided several troubleshooting steps, from checking permalinks and disabling plugins to fixing mixed content and viewing the REST API debug log. Implement these solutions methodically to identify the root cause and resolve this WordPress JSON error.
If the problem persists, consider contacting a WordPress professional for further assistance. Should you have any questions or tips for fixing this issue, please use the comment box below.
Updating failed. The response is not a valid JSON response error FAQ
What is the JSON response in WordPress?
A JSON response in WordPress is data exchanged between the server and browser, particularly in the editor. WordPress uses JSON to communicate via the REST API for tasks like saving and publishing content.
How do I handle the JSON response error?
To handle the JSON response error, check URL settings, permalinks, plugins, and server configurations. Then, follow troubleshooting steps like deactivating plugins, reviewing the REST API debug log, and adjusting security settings to resolve the issue.
How do I check if JSON is valid or not?
To check if JSON is valid, use online tools like JSONLint or browser developer tools like Google Chrome’s Network tab. Copy the JSON response, paste it into the tool, and validate. The tool will highlight errors in the JSON structure for correction.