How to Fix the “Not a Valid JSON Response” Error in WordPress: Step-by-Step Troubleshooting Guide

If you’ve ever encountered the dreaded “Not a valid JSON response” error while working with WordPress, particularly when trying to update a page or post, you’re not alone. This common error can be frustrating, especially when it breaks your ability to save content or slows down your workflow. Fortunately, resolving the issue is often easier than it appears. In this guide, we’ll walk through the possible causes and show you how to fix the “Not a valid JSON response” WordPress error—step by step.

What Triggers the JSON Response Error?

At its core, the “Not a valid JSON response” error is a communication breakdown between your browser and the server when using the WordPress block editor (also known as Gutenberg). The editor sends data using JSON (JavaScript Object Notation), and if that data isn’t returned in the correct format—boom, error.

It usually occurs when you try to:

  • Publish or update a post or page
  • Add or update media such as images
  • Use the REST API to connect plugins or themes

There are quite a few reasons this might happen, including permalinks misconfiguration, plugin conflicts, server-side issues, or even simple SSL miscommunication. Let’s dive into the step-by-step fix.

Step-by-Step Guide to Fix the JSON Response Error

1. Check Your Permalink Settings

Incorrect permalinks can affect how WordPress communicates with its REST API, which is essential for the block editor to function properly.

  1. Log in to your WordPress dashboard.
  2. Go to Settings > Permalinks.
  3. Click Save Changes without modifying anything.

This forces WordPress to flush the rewrite rules and rebuild its permalinks, often fixing the issue right away.

2. Check Site URL and WordPress Address

If your WordPress Address (URL) and Site Address (URL) don’t match or aren’t using HTTPS properly, it could result in a JSON error.

  1. Go to Settings > General.
  2. Ensure both fields are identical and start with https://.
  3. Update and save the changes if needed.

Make sure your SSL certificate is valid to avoid communication blocks.

3. Inspect for Plugin Conflicts

The quickest way to determine if a plugin is causing the issue is to deactivate all plugins and then reactivate them one by one.

  1. Navigate to Plugins > Installed Plugins.
  2. Select all plugins and choose Deactivate.
  3. Try to update a post or page. If the error disappears, reactivate each plugin one at a time.

The bug will likely reappear after activating the offending plugin. Once identified, look for plugin updates, contact the developer, or consider switching to an alternative.

4. Switch to a Default WordPress Theme

A poorly coded theme can interfere with the REST API. To check:

  1. Go to Appearance > Themes.
  2. Activate a default theme like Twenty Twenty-One.
  3. Retry saving your post.

If it works, the issue lies within your theme. Consider downloading an updated version or asking a developer to inspect it.

5. Check the REST API Status

WordPress has a built-in tool to verify if the REST API is functioning properly:

  1. Go to Tools > Site Health.
  2. Look under the Status tab for REST API errors.

If WordPress cannot access the REST API, it may list server-related issues or mod_security restrictions that are affecting it. This is valuable insight into what to fix next.

6. Verify SSL Certificate and HTTPS Availability

WordPress relies heavily on HTTPS, especially when connecting via the REST API. Mixed content or invalid certificates can lead to JSON errors.

  1. Use an online SSL checker tool like SSL Labs.
  2. Make sure your browser doesn’t show a “Not Secure” warning.
  3. Install an SSL plugin like Really Simple SSL if configuration is a concern.

Ensuring every piece of content loads over HTTPS will remove any security barriers between your browser and WordPress.

7. Increase PHP Memory Limit

Sometimes JSON errors appear when your server doesn’t have enough memory to process AJAX requests. You can manually increase the PHP memory limit:

  1. Open your wp-config.php file.
  2. Add the following line before /* That's all, stop editing! */:
define('WP_MEMORY_LIMIT', '256M');

This will allow WordPress to allocate more memory, which often resolves slow or incomplete responses.

8. Check .htaccess File

The .htaccess file in the root folder of your WordPress site controls URL routing. If it gets corrupted, it can block REST API calls.

  1. Back up your .htaccess file.
  2. Replace its content with the default WordPress rules:
# 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

After editing, test again to see if the error goes away.

9. Adjust WordPress Heartbeat API

The Heartbeat API sends periodic requests to the server, and too many can lead to JSON errors if your server restricts them.

You can manage Heartbeat using a plugin like Heartbeat Control:

  • Install and activate the plugin.
  • Adjust the frequency and limit activity only to specific areas like the post editor.

This can reduce server strain and communication issues.

10. Contact Hosting Provider

If none of the above solutions work, your server might be misconfigured or protected by a firewall that’s interfering with REST API calls. Contact your web hosting provider and ask:

  • Whether the REST API is being blocked or limited
  • If mod_security is causing issues
  • About increasing relevant PHP variables like max_execution_time or post_max_size

Bonus Tip: Use the Classic Editor if Needed

You can temporarily use the old Classic Editor if none of the fixes work and you need to finish pressing content updates:

  1. Install the Classic Editor plugin from the WordPress repository.
  2. Activate it to switch away from the block editor.

This is a temporary workaround but could buy you time while investigating a more permanent fix.

Wrapping Up

The “Not a valid JSON response” error in WordPress can seem intimidating at first, but with a systematic approach, you can find and resolve the root cause. Whether it’s a misbehaving plugin, theme conflict, or server issue, following this checklist will help you get back to building content in no time.

And remember, always keep your themes, plugins, and WordPress core up to date. Most errors can be avoided with routine maintenance and best practices. Happy editing!