You’ve just made some updates to your WordPress site, and you’re feeling pretty good about it. You hit the update button, ready to see your changes go live, and then—bam! You’re hit with that dreaded red message: “Updating failed. The response is not a valid JSON response.”
You might also see it phrased as “Publishing failed. The response is not a valid JSON response” or encounter it when uploading images directly into a block. This invalid JSON error goes by several names, but the root cause is always the same: the block editor sent a request to the server and didn’t get back the properly formatted response it expected.
The good news? This error is almost always fixable. In most cases, the solution is one of the first three fixes on this list. Work through them in order, and you’ll likely have your site working again within minutes.
Table of contents
What Causes the “Not a Valid JSON Response” Error?
To understand this error, you need to know how the WordPress block editor saves your content.
The block editor (also called Gutenberg) doesn’t submit forms the way older web pages do. Instead, it communicates with your WordPress server through something called the REST API. The REST API is a system built into WordPress that handles requests between the editor running in your browser and the server where your site lives.
Every time you click Save, Publish, or upload a file, the block editor sends a request through the REST API and expects a response in JSON format. JSON (JavaScript Object Notation) is a lightweight data format that both your browser and server can read easily. It’s how WordPress passes information back and forth behind the scenes.
When that communication breaks down, you get the “not a valid JSON response” error. The server either didn’t respond, responded with something other than JSON (like an HTML error page), or the request never reached the server at all.
Common Causes at a Glance
This breakdown can happen at several points:
- Incorrect WordPress URL settings that send REST API requests to the wrong address
- Broken permalink structure or a corrupted .htaccess file that prevents REST API endpoints from resolving
- SSL and mixed content issues where HTTP/HTTPS mismatches block requests
- Plugin or theme conflicts that output invalid data or throw PHP errors during REST API calls
- Firewall or security plugin rules that mistake legitimate editor requests for attacks
- A missing PHP JSON extension on the server
- Server configuration problems like resource limits or restrictive permissions
Now, let’s fix it.
How to Fix the Invalid JSON Response Error in WordPress
Work through these fixes in order. The first few address the most common causes and take just a minute or two. Only move to the deeper troubleshooting steps if the quick fixes don’t resolve the issue.
1. Check Your WordPress URL Settings
Why this fix works: The block editor uses your site’s base URL to make REST API calls. If the WordPress Address or Site Address is wrong (pointing to an old domain, a subdirectory, or using HTTP instead of HTTPS), those API requests go to the wrong location and fail.
To check your URL settings:
- Log in to your WordPress dashboard.
- Go to Settings > General.
- Look at the WordPress Address (URL) and Site Address (URL) fields.
- Make sure both URLs match and both start with https:// if you have an SSL certificate installed.
- Click Save Changes if you made any corrections.

If these fields are greyed out, the URLs are defined as constants in your wp-config.php file. You’ll need to edit that file directly to make changes.
After saving, go back to the post or page where the error appeared and try updating again.
2. Fix Your Permalink Structure
Why this fix works: When you save your permalink settings, WordPress regenerates the URL rewrite rules it uses to route requests, including REST API requests. Even if you don’t change any settings, clicking Save forces WordPress to rebuild these rules. It’s often enough to fix a broken connection.
- Go to Settings > Permalinks.
- Note your current setting (most sites use Post name).
- Click Save Changes without changing anything.
- Go back to the block editor and test.

This single step fixes the problem for a surprising number of people. If it worked for you, great. If not, the next fix goes a level deeper into the same issue.
For a deeper understanding of how WordPress URL structures work, see our WordPress permalinks guide.
3. Regenerate Your .htaccess File
Why this fix works: On Apache servers, WordPress stores URL rewrite rules in a file called .htaccess located in your site’s root directory. These rules are what make REST API endpoints like /wp-json/ accessible. If the file gets corrupted (from a failed update, a plugin conflict, or manual editing), those endpoints stop working and the block editor can’t reach the server.
To regenerate it:
- Connect to your site via FTP or your hosting provider’s file manager.
- Navigate to your site’s root directory (usually public_html).
- Download the existing .htaccess file to your computer as a backup.
- Delete the .htaccess file from the server.
- In WordPress, go to Settings > Permalinks and click Save Changes. This creates a fresh .htaccess file with the correct rewrite rules.

Test the block editor again. For more details on this file and what it controls, check out our guide to the .htaccess file in WordPress.
Nginx users: Nginx doesn’t use .htaccess files. If your site runs on Nginx, rewrite rules are managed in the server configuration. Contact your hosting provider if you suspect a routing issue.
4. Fix SSL and Mixed Content Issues
Why this fix works: Mixed content occurs when your site loads over HTTPS but some resources (images, scripts, stylesheets) still load over HTTP. Browsers block these insecure requests, and if the block editor’s REST API calls get caught in the crossfire, the JSON response never arrives.
To check and fix this:
- Open Settings > General and confirm both URLs start with https://.
- Press F12 in your browser to open Developer Tools, then check the Console tab for mixed content warnings. These look like: “Mixed Content: The page at ‘https://…’ was loaded over HTTPS, but requested an insecure resource ‘http://…’.”
- Install a plugin like Really Simple SSL to automatically fix mixed content references across your site.
- If you use Cloudflare, make sure the SSL/TLS encryption mode is set to Full (Strict).
For a complete walkthrough on moving your site to HTTPS, see our guide on how to switch from HTTP to HTTPS in WordPress.
5. Use WordPress Site Health to Check the REST API
Why this fix works: WordPress includes a built-in diagnostic tool called Site Health that specifically tests whether the REST API is functioning. Instead of guessing at the problem, this tool tells you directly.
- Go to Tools > Site Health.
- Click the Status tab.
- Look for a critical issue labeled “The REST API encountered an unexpected result.”
- If it appears, expand it for details about what’s failing.

This information can save you a lot of trial and error. If Site Health reports the REST API is working fine, the issue is more likely related to a specific plugin, theme, or firewall rule rather than a server-level problem.
6. Test the wp-json Endpoint Directly
Why this fix works: You can confirm whether the REST API is accessible with a quick browser test. This takes about 10 seconds and immediately tells you whether the problem is at the server/routing level or something else.
Open a new browser tab and visit:
https://yoursite.com/wp-json/
Replace “yoursite.com” with your actual domain.
If the REST API is working, you’ll see a page full of JSON data (structured text with curly braces and key-value pairs). This means the REST API endpoint is reachable, and the problem is likely caused by a specific plugin, theme, or request being blocked.
If you see a 404 error, a redirect, or an HTML page, the REST API endpoint isn’t accessible. This points to a permalink or .htaccess problem (go back to fixes #2 and #3).
7. Deactivate Plugins to Identify Conflicts
Why this fix works: Plugins run code during REST API requests. A poorly coded plugin, a plugin with a PHP error, or a plugin that modifies REST API responses can corrupt the JSON output. Security plugins and caching plugins are especially common culprits.
- Go to Plugins > Installed Plugins.
- Select all plugins using the checkbox at the top.
- From the Bulk Actions dropdown, select Deactivate and click Apply.
- Test the block editor.
- If the error is gone, reactivate plugins one at a time, testing after each.
- When the error returns, you’ve found the conflicting plugin.
Once you identify the problem plugin, check if there’s an update available. If updating doesn’t help, contact the plugin developer or look for an alternative. For help adding replacement plugins, see our guide on how to install a plugin on WordPress.
Common culprits: Wordfence, Sucuri, iThemes Security, WP Rocket, W3 Total Cache, and other security or caching plugins are frequently involved.
8. Switch to a Default WordPress Theme
Why this fix works: Themes can cause this error in several ways. A theme might output extra whitespace or HTML before the JSON response, throw a PHP error in the background, or have custom REST API modifications that break the expected format.
- Go to Appearance > Themes.
- Activate a default WordPress theme like Twenty Twenty-Five or Twenty Twenty-Four.
- Test the block editor.
- If the error disappears, your theme is the cause.
If the theme is responsible, check for available updates first. If the error persists even with the latest version, contact the theme developer. In some cases, a theme’s functions.php file may contain code that outputs content before the JSON response, which is enough to trigger the invalid JSON error even without any visible issues on the front end.
9. Disable Your Firewall or Security Plugin Temporarily
Why this fix works: Web application firewalls (WAF) and security plugins monitor all requests to your site. The block editor sends frequent background requests (auto-saves, content updates, media uploads), and aggressive security rules can flag these as suspicious. When a firewall blocks a REST API request, the editor receives a 403 error or a challenge page instead of valid JSON.
To test this:
- Temporarily deactivate your security plugin (Wordfence, Sucuri, All In One Security, etc.).
- Test the block editor.
- If the error is gone, the security plugin is blocking REST API requests.
To fix it permanently without removing your security plugin:
- Check the plugin’s firewall logs to identify which rule triggered the block.
- Whitelist the /wp-json/ endpoint or the specific REST API routes used by the block editor.
- If you’re using Cloudflare WAF or server-level mod_security, contact your hosting provider and ask them to check the logs and whitelist legitimate WordPress requests.
For more on WordPress security configurations, see our guide to common WordPress security issues and fixes.
10. Check the PHP JSON Extension
Why this fix works: WordPress requires the PHP JSON extension to encode and decode JSON data. Most hosting environments include it by default, but some custom server configurations, minimal PHP installations, or older hosts may not have it enabled. When it’s missing, WordPress can’t process JSON at all, and you may see a notice like “WordPress X.X requires the JSON PHP extension.”
To check:
- Go to Tools > Site Health > Info tab.
- Expand the Server section.
- Look through the list of PHP extensions for json.
- If it’s not listed, contact your hosting provider and ask them to enable it.
You can also verify from the command line if you have SSH access:
php -m | grep json
If the extension is present but the error persists, this isn’t your issue. Move to the next fix.
11. Enable WordPress Debug Mode
Why this fix works: A PHP error happening in the background can silently corrupt the JSON response. WordPress debug mode captures these errors in a log file so you can see exactly what’s failing and which file is responsible.
- Connect to your site via FTP or file manager.
- Open wp-config.php.
- Find the line that says /* That’s all, stop editing! */ and add this code above it:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
- Save the file.
- Go back to the block editor and reproduce the error.
- Check wp-content/debug.log for error entries.
The log entries will include file paths and line numbers, pointing you to the exact plugin, theme, or core file causing the issue. This is the most reliable way to diagnose stubborn cases.
Important: Turn off debug mode when you’re done troubleshooting by changing WP_DEBUG back to false. Leaving it active can expose error details and slow down your site.
12. Upload Media Through the Media Library Instead
If the error specifically appears when you upload images or files through the block editor, you can bypass it by uploading directly through the Media Library.
- Go to Media > Add New in your dashboard.
- Upload your files there.
- When adding media to a post, click Media Library in the block instead of Upload.
This is a workaround, not a permanent fix. But it keeps you productive while you track down the root cause.
A few additional tips for media-related JSON errors:
- Rename files to remove special characters like &, %, $, or spaces. Use hyphens instead.
- Upload files one at a time rather than in batches.
- Use the Featured Image panel in the sidebar rather than adding featured images through blocks.
- For images that consistently fail, try converting them to a different format (PNG to JPG or vice versa) before uploading.
13. Use the Classic Editor as a Temporary Workaround
The Classic Editor doesn’t depend on the REST API for saving content, so it sidesteps the JSON communication entirely.
- Install and activate the Classic Editor plugin.
- Go to Settings > Writing.
- Set Classic Editor as the default editor for all users.
- Save changes and edit your content normally.
This keeps your workflow running while you troubleshoot. Once you’ve identified and fixed the underlying issue, switch back to the block editor.
Keep in mind: The REST API powers more than just the block editor. Many plugins, integrations, and WordPress features depend on it. Using the Classic Editor avoids the symptoms, but fixing the root cause matters for the overall health of your site.
Frequently Asked Questions
It means the WordPress block editor sent a request to the server but didn’t receive a properly formatted JSON response back. This is a communication breakdown between the editor and your server, usually caused by URL misconfigurations, broken permalinks, plugin conflicts, or firewall rules blocking the REST API.
It has the same root cause as the “updating failed” version. The only difference is the action that triggered it. “Publishing failed” appears when you try to publish a new post, while “Updating failed” shows up when saving changes to an existing post. The fixes are identical for both.
The block editor (Gutenberg) communicates with the server through the WordPress REST API using JSON. Every save, publish, and upload action goes through this system. The Classic Editor uses a different method called admin-ajax that doesn’t depend on JSON responses the same way. That’s why this error is specific to the block editor.
Yes. Security plugins and web application firewalls (like Wordfence, Sucuri, or Cloudflare WAF) can mistake legitimate REST API requests from the block editor for suspicious activity. When they block these requests, the editor receives an error page or a 403 response instead of valid JSON. Temporarily disabling the security plugin is the fastest way to confirm if this is the cause.
Visit yoursite.com/wp-json/ in your browser. If the REST API is working correctly, you’ll see a page of structured JSON data. If you see a 404 error, a redirect, or an HTML error page, the endpoint isn’t accessible. You can also go to Tools > Site Health in your WordPress dashboard, which includes a specific check for REST API functionality.
This notice means your server’s PHP installation is missing the JSON extension, which WordPress needs to process JSON data. This is uncommon on modern hosting, but it can happen with custom server configurations. Contact your hosting provider and ask them to enable the PHP JSON extension.
Usually not. The error means your changes weren’t saved to the server yet, but your content should still be visible in the editor. Don’t close or navigate away from the page. Try saving again after applying one of the fixes above. If you need to leave the page, copy your content to a text editor first as a safety measure.
If you’ve worked through every step on this list, the issue likely involves a server-level configuration that you can’t access directly. Contact your hosting provider and share the specific error details along with any entries from your debug.log file. They can check server logs, mod_security rules, PHP configuration, and resource limits on their end.
Wrapping Up
The “not a valid JSON response” error comes down to a broken communication line between the WordPress block editor and your server. In most cases, re-saving your permalink settings or fixing your URL configuration is all it takes. For trickier situations, work through the plugin, theme, and firewall checks systematically, and use debug mode to pinpoint the exact cause.
Here’s the quick summary:
- The error means the block editor’s REST API communication with the server is broken.
- Start simple: check URL settings, re-save permalinks, regenerate .htaccess.
- Check SSL: mixed content and HTTP/HTTPS mismatches are a common but overlooked cause.
- Isolate conflicts: deactivate plugins and switch themes to find the culprit.
- Use diagnostics: Site Health, the wp-json endpoint test, and debug mode give you specific answers instead of guesswork.
- Workarounds exist: the Classic Editor and Media Library uploads keep you productive while troubleshooting.