Fix “Updating failed. The response is not a valid JSON response” in WordPress [Image Upload Issue]

Frustrated by the 'Updating failed. The response is not a valid JSON response' error in WordPress? Learn step-by-step solutions with .htaccess fixes,

Are you tired of seeing the dreaded “Updating failed. The response is not a valid JSON response.” error when you try to update or publish posts on your WordPress website? Don’t worry — you’re not alone. Thousands of site owners face this annoying problem, and thankfully, it’s usually easy to fix.

What Causes the JSON Response Error in WordPress?

This error happens when WordPress’s REST API can’t communicate properly with your server. In simple words, your site tries to send or receive data (like saving a post), but the server gives back something unexpected — not valid JSON data. This breaks the process.

Common causes include:

  • Broken permalinks or missing .htaccess rules
  • SSL or HTTPS misconfigurations
  • Security plugins or ModSecurity blocking requests
  • Mixed content (HTTP + HTTPS)
  • Incorrect WordPress Address / Site Address
  • Theme or plugin conflicts

Step-by-Step Solutions to Fix the JSON Error

1. Reset Permalinks

One of the easiest fixes is to reset your permalinks. Go to Dashboard > Settings > Permalinks and click Save Changes without changing anything. This refreshes your .htaccess file and often fixes the problem instantly.

2. Check Site URLs

Navigate to Settings > General and ensure that your WordPress Address (URL) and Site Address (URL) both match and use https:// if you have SSL installed. If one is HTTP and the other HTTPS, that will cause JSON errors.

3. Disable Security Plugins Temporarily

Sometimes plugins like Wordfence, iThemes Security, or firewall plugins block REST API calls. Try disabling them temporarily and test again. If it works, adjust your plugin settings to allow REST API.

4. Check for Console Errors

Right-click your site, click Inspect and go to the Console tab. If you see red errors, note them down. This helps pinpoint issues like blocked AJAX calls or mixed content errors.

5. Increase PHP Memory Limit

Edit your wp-config.php file and add this line to increase memory, which can help:

define('WP_MEMORY_LIMIT', '256M');
Related Posts

6. Fix Mixed Content

Use the Really Simple SSL plugin to force all content to load over HTTPS. This prevents the browser from blocking certain requests that lead to JSON errors.

7. Reinstall WordPress Core Files

Go to Dashboard > Updates and click Re-install Now. This replaces any corrupted core files without harming your content.

Special: Disable ModSecurity Rules with .htaccess

If your hosting uses ModSecurity (common in cPanel shared hosting), it might block JSON POST requests. You can disable it by adding this code to the top of your .htaccess file inside public_html:

<IfModule mod_security.c>
SecRuleEngine Off
SecFilterInheritance Off
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

⚠️ Note: Only use this if you trust your security environment. Disabling ModSecurity globally reduces protection, so ask your host for the safest approach.

Bonus Tips to Avoid JSON Errors in Future

  • Keep WordPress, themes, and plugins updated.
  • Use a reliable SSL certificate and redirect HTTP to HTTPS properly.
  • Ask your host to whitelist REST API calls if they use strict firewalls.
  • Run Site Health under Tools > Site Health to catch issues early.

Conclusion

Seeing “The response is not a valid JSON response” might look scary, but with these simple tweaks — resetting permalinks, fixing HTTPS, adjusting .htaccess, and disabling strict security temporarily — your site should be back to working perfectly. Keep your site tidy, updated, and always backup before making big changes!

About the author

Leo
Hey! I'm Leo. I'm always eager to learn new things and enjoy sharing my knowledge with others.

Post a Comment

To avoid SPAM, all comments will be moderated before being displayed.
Don't share any personal or sensitive information.