If you’ve been editing or publishing a post in WordPress and suddenly run into the dreaded error:
“The response is not a valid JSON response”,
you’re not alone.
This is a common issue in WordPress, especially since the introduction of the Gutenberg block editor, and it can be caused by a variety of reasons—from permalinks and SSL misconfigurations to plugin conflicts and server issues.
In this blog, we’ll walk through:
- What causes the “not a valid JSON response” error
- How to diagnose the problem
- Step-by-step solutions to fix it
What Does “Not a Valid JSON Response” Mean?
When you save or update a post in WordPress, the editor communicates with the server using AJAX and the REST API. The server sends back data in JSON format. If something goes wrong—like the server not responding correctly or returning an HTML error instead of JSON—you’ll get this error.
Common Causes of the Error
- Incorrect Permalink Settings
- SSL (HTTPS) Issues or Mixed Content
- Blocked REST API
- Plugin or Theme Conflicts
- .htaccess Misconfiguration
- Security Plugins or Firewalls Blocking Requests
- CORS or ModSecurity on Server
- Trailing Slash or Site URL Mismatch
How to Fix “Not a Valid JSON Response” in WordPress
1. Reset Permalinks
Sometimes permalink structures break.
Steps:
- Go to Settings > Permalinks
- Don’t change anything, just click Save Changes
This flushes and refreshes your .htaccess
rules.
2. Fix HTTPS / Mixed Content Issues
Make sure your WordPress Address and Site Address URLs match and use HTTPS.
Steps:
- Go to Settings > General
- Ensure both URLs begin with
https://
- Use a plugin like Really Simple SSL to force HTTPS everywhere
3. Disable Plugins Temporarily
A conflicting plugin can block or corrupt REST API requests.
Steps:
- Disable all plugins
- Try editing a post again
- If it works, re-enable one-by-one to identify the culprit
4. Switch to a Default Theme
Sometimes, the theme you’re using may cause conflicts.
Steps:
- Switch to a default theme like Twenty Twenty-Four
- Try editing a post
- If the error disappears, the issue is likely in your theme’s
functions.php
or custom AJAX handling
5. Check Site Health
Use the built-in Site Health tool.
Steps:
- Go to Tools > Site Health
- Look for REST API issues or critical errors
- Follow the recommended fixes
6. Check .htaccess File
Broken or malformed .htaccess
rules can interfere with JSON responses.
Steps:
- Backup your
.htaccess
file - Replace it with the default:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
7. Check Firewall / Security Plugins
Plugins like Wordfence or server firewalls might block REST API or JSON requests.
Steps:
- Temporarily disable security plugins
- Try editing again
- If the issue is resolved, adjust the plugin settings to allow API access
8.Check Console Errors
Use Developer Tools in your browser (Right-click → Inspect → Console tab)
Look for:
- Red errors
- Failed API requests
- CORS or 403/500 errors
This can give clues on what’s causing the issue.
Still Not Working?
If none of the above work:
- Check your hosting provider – shared hosts sometimes restrict REST routes
- Look into ModSecurity logs
- Check WP_DEBUG_LOG for detailed error messages in
wp-content/debug.log
Pro Tip: Enable Debug Logging
Add this to your wp-config.php
to catch backend issues:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Then check wp-content/debug.log
for any related error messages.
Final Thoughts
The “Not a Valid JSON Response” error in WordPress can be frustrating—but it’s usually fixable with a little debugging. Follow the steps above in order, and you’ll likely find and fix the issue quickly.
Still stuck? Try reaching out to your hosting provider, or check the WordPress support forums.