Sector 84, Gurgaon 122004, Haryana · Monday to Saturday, 9 AM to 5 PM +91 9818450754 [email protected]

Fix “The Response Is Not a Valid JSON Response” in WordPress

WordPress block editor showing the error updating failed, the response is not a valid JSON response
In this article
  1. What does “The response is not a valid JSON response” mean?
  2. What causes the JSON response error in WordPress?
  3. How do you find the real cause in two minutes?
  4. How do you fix the “not a valid JSON response” error?
  5. 1. Resave your permalinks
  6. 2. Make your WordPress Address and Site Address match
  7. 3. Clear your cache and exclude the REST API
  8. 4. Deactivate plugins to find a conflict
  9. 5. Switch to a default theme
  10. 6. Check your firewall and security rules
  11. 7. Stop PHP errors from printing on the page
  12. 8. Ask your hosting provider
  13. Is installing the Classic Editor a good fix?
  14. Does the JSON response error affect SEO?
  15. A practical example: the error that hit only one post
  16. Frequently asked questions
  17. Why does the JSON error appear on only one post?
  18. Why do I get the JSON error when uploading images?
  19. Can an SSL certificate cause this error?
  20. Is it safe to edit the .htaccess file?
  21. Can Cloudflare cause the “not a valid JSON response” error?
  22. Will reinstalling WordPress fix it?
  23. How do I know if my REST API is working?
  24. Need help fixing it?

You click Update or Publish, and instead of saving, WordPress shows a red notice: “Updating failed. The response is not a valid JSON response.” Your changes sit there unsaved, and the message gives you no clue about what went wrong.

The good news is that this error almost always comes from a small set of causes, and most of them take less than ten minutes to fix. This guide explains what the error means, how to find the real cause quickly, and the eight fixes we try, in the order we try them.

We ran into this exact error ourselves while publishing posts on the Balhara Infotech website after moving it to WordPress. So this guide comes from working through the problem, not just reading about it.

Key takeaways

  • The error means the WordPress block editor asked your server for data in JSON format and got something else back, usually an error page or a blocked request.
  • The most common causes are broken permalinks, an http and https mismatch, a security firewall, a caching plugin or a plugin conflict.
  • Open yoursite.com/wp-json/ in your browser. If you do not see a page of JSON data, the problem is on the server side.
  • Fix in this order: permalinks, site URLs, cache, plugins, theme, firewall, PHP errors, hosting.
  • The Classic Editor plugin hides the error but does not fix it.

What does “The response is not a valid JSON response” mean?

This WordPress error means the block editor sent a request to your site’s REST API and expected a reply in JSON format, but received something else, such as an HTML error page, a firewall block or stray PHP output. WordPress cannot read that reply, so your post or page fails to save.

The block editor (also called Gutenberg) does not save your work like an old style web form. Every save, autosave and image upload is a small request sent in the background to an address on your site that starts with /wp-json/. That address is the WordPress REST API, a way for different parts of software to talk to each other in a structured format.

When anything stops that conversation, you see the JSON error. So the error itself is only a symptom. The real problem is whatever blocked or broke the REST API reply.

What causes the JSON response error in WordPress?

The most common causes are broken permalink rules, a mismatch between your WordPress Address and Site Address, a security firewall blocking the request, a caching or optimisation plugin, a plugin or theme conflict, and PHP warnings printed into the response. The table below shows how to spot each one.

Cause Typical sign Fix
Broken permalinks or .htaccess /wp-json/ shows a 404 page Resave permalinks
http and https mismatch Error started after adding SSL or changing domain Match both site URLs
Firewall or security rules 403 Forbidden, often on only one post Allow the blocked request
Caching or minify plugin Error started after turning on cache or minify Exclude /wp-json/, clear cache
Plugin conflict Error started after a plugin install or update Deactivate plugins one at a time
Theme code Error started after a theme change or code edit Switch to a default theme
PHP warnings on screen Response starts with “Warning” or “Notice” Log errors instead of showing them

How do you find the real cause in two minutes?

Open the post in Chrome, press F12, choose the Network tab and click Update again. Click the failed request in the list and open its Response tab. The status code and the first few lines of the reply usually point straight to the cause, so you fix the right thing first.

Here is how to read what you see:

  • 404 Not Found: your permalink rules are broken. Start with Fix 1.
  • 403 Forbidden: a firewall or security plugin blocked the request. Go to Fix 6.
  • 500 Internal Server Error: a PHP error, usually from a plugin or theme. Try Fixes 4, 5 and 7.
  • An HTML page or a redirect: often an http and https mismatch. Go to Fix 2.
  • Text like “Warning:” before the data: PHP is printing errors on screen. Go to Fix 7.

Two more quick checks help. Open https://yoursite.com/wp-json/ in a new tab. A working site shows a long page of structured data. Then go to Tools > Site Health in your dashboard. If you see “The REST API encountered an error”, WordPress has confirmed the problem.

How do you fix the “not a valid JSON response” error?

Work through these eight fixes in order, testing a save after each one. The first three solve most cases and take only a few minutes. Plugin, theme and firewall checks come next, and your hosting provider is the last stop when the cause sits on the server itself.

Go to Settings > Permalinks and click Save Changes without changing anything. This rebuilds your permalink rules, which fixes most 404 errors on the REST API.

If the error stays, open your .htaccess file (in your site’s root folder, through your hosting file manager) and check that it contains the standard WordPress block. Take a backup of the file first.

# BEGIN WordPress
<IfModule mod_rewrite.c>
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]
</IfModule>
# END WordPress

If your site runs on an Nginx server, there is no .htaccess file. Ask your host to check the rewrite rules in the server settings.

2. Make your WordPress Address and Site Address match

Go to Settings > General. The WordPress Address and Site Address should be identical, including https and www (or no www). A mismatch is very common right after installing an SSL certificate or moving a site to a new domain.

If these fields are greyed out, they are set in your wp-config.php file. Check the WP_HOME and WP_SITEURL lines there.

3. Clear your cache and exclude the REST API

Clear every layer of cache you use: your caching plugin, your hosting cache and your CDN (such as Cloudflare). Then check your caching plugin settings and make sure /wp-json/ is excluded from caching.

Also turn off JavaScript minify and combine options for a moment and test again. These options sometimes break scripts the editor needs.

4. Deactivate plugins to find a conflict

Deactivate all plugins, then try saving. If it works, reactivate them one at a time and save after each one until the error comes back. The last plugin you turned on is the culprit.

Security, caching and redirection plugins are the usual suspects, so test those first. If you cannot reach your dashboard, rename the plugins folder inside wp-content using your file manager. That turns every plugin off at once.

5. Switch to a default theme

Temporarily activate a default WordPress theme, such as Twenty Twenty Five, and try saving. If the error disappears, your theme is the cause.

A frequent reason is a blank line or a space before the opening <?php tag in the theme’s functions.php file. That small piece of output lands in front of the JSON reply and breaks it. Custom themes are more likely to have this than well known ones.

6. Check your firewall and security rules

If the Network tab shows a 403 error, something is blocking the request on purpose. On shared hosting with cPanel, this is often ModSecurity, a server firewall that blocks requests that look like attacks.

This is why the error sometimes appears on just one post. A post containing code samples, <script> or <iframe> tags, or text that looks like a database command can trigger a rule. Ask your host to check the ModSecurity log for your domain and allow the specific rule. If you use Cloudflare, check Security > Events for blocked requests, and if you use a security plugin, look at its firewall log.

7. Stop PHP errors from printing on the page

If the response starts with “Warning” or “Notice”, PHP is printing messages into the reply. Add these lines to wp-config.php, above the line that says “That’s all, stop editing”:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Errors are now saved to a log in wp-content/debug.log instead of appearing on screen. Read the log to find the plugin or file causing the warning, fix or replace it, and then set WP_DEBUG back to false on your live site.

8. Ask your hosting provider

If nothing above works, the cause is probably at server level: a firewall rule, a PHP version or memory limit, or a block on the REST API. Send your host the page URL, the time of the error and the status code from the Network tab. Those three details save a lot of back and forth.

Is installing the Classic Editor a good fix?

No. The Classic Editor plugin saves posts through a normal form, so it does not use the REST API and the error disappears. But the underlying problem is still there, and other features that depend on the REST API stay broken. Use it only to publish something urgent, then fix the real cause.

Does the JSON response error affect SEO?

Not directly. Google never sees errors inside your dashboard. The indirect effects are real though: updates get delayed, fresh content stays unpublished, and some SEO plugin features that rely on the REST API stop working.

At Balhara Infotech, we check the Site Health screen in every technical SEO audit. A broken REST API often hints at deeper server or plugin issues that also affect speed and crawling, so it is worth fixing properly rather than working around.

A practical example: the error that hit only one post

Here is a pattern that is common on shared hosting. A small business owner writes a blog post about website security, and the post includes a short code snippet with a <script> tag. Every other post saves normally, but this one fails every time with the JSON error.

The Network tab shows a 403 Forbidden status. The host’s ModSecurity firewall is treating the code snippet as an attack. Once the host allows that specific rule for the domain, the post saves straight away, with no plugin or theme changes needed.

The lesson: when the error affects only one post, look at what is inside that post before you start deactivating plugins.

Frequently asked questions

Why does the JSON error appear on only one post?

Usually a firewall such as ModSecurity is blocking that post’s content. Code snippets, script or iframe tags, and text that looks like a database command can all trigger security rules. Check the Network tab for a 403 status and ask your host to review the firewall log.

Why do I get the JSON error when uploading images?

Image uploads in the block editor also use the REST API, so the same causes apply. Also check that the file name has no special characters, the file is within your upload size limit, and the uploads folder has the correct write permissions.

Can an SSL certificate cause this error?

Yes. After installing SSL, the WordPress Address and Site Address can end up with different settings, one on http and one on https. Make both URLs identical in Settings > General and clear your cache.

Is it safe to edit the .htaccess file?

It is safe if you take a backup first. A single mistake in this file can take your whole site offline, so keep a copy you can restore through your hosting file manager within seconds.

Can Cloudflare cause the “not a valid JSON response” error?

Yes. Cloudflare’s firewall can block editor requests, and caching or script optimisation settings can change the reply. Check Security Events for blocks and make sure the admin area and /wp-json/ are not cached.

Will reinstalling WordPress fix it?

Rarely. WordPress core files are almost never the cause. Permalinks, site URLs, plugins, themes and server firewalls are far more likely, so check those first.

How do I know if my REST API is working?

Open yoursite.com/wp-json/ in your browser. A working REST API shows a long page of structured data. You can also check Tools > Site Health in your dashboard for REST API errors.

Need help fixing it?

Most of the time, resaving permalinks, matching your site URLs or finding one plugin conflict is enough. If you have tried everything here and posts still will not save, the cause is usually a server or firewall rule that needs a closer look.

That is exactly what we check in a technical audit. Get a free SEO audit from Balhara Infotech and we will look at your site’s health, speed and technical setup, and explain what we find in plain language.

Written by Hariom Balhara

Hariom Balhara is the founder of Balhara Infotech, an SEO and digital marketing agency in Gurgaon. He helps local businesses, startups and brands across India get found on Google and in AI answers, and writes about SEO, local search and website growth in plain, practical language.