While working on a blog post, I encountered an unusual WordPress error: “The response is not a valid JSON response.” It appeared when I tried uploading images through the Gutenberg editor.
If you’ve encountered the same error while uploading images, saving changes, or publishing a post, you’re not alone.
This error generally indicates that WordPress expected a JSON response from its REST API but received something else, such as an HTML error page, a redirect, or a server error.
There can be several reasons behind it, including incorrect permalink settings, REST API issues, plugin conflicts, security restrictions, or server configuration problems.
This was pretty much weird. Here is what it looks like!

Let’s understand why this happens and explore the practical ways to fix the invalid JSON response error in WordPress.
What Does “The Response Is Not a Valid JSON Response” Mean?
WordPress uses the REST API to exchange information between the website and the block editor (Gutenberg).
For example, when you upload an image, save a draft, or publish a post, Gutenberg communicates with your WordPress website through REST API requests.
These requests expect a properly formatted JSON response. However, if the server returns an unexpected response, such as an error page, redirect, or PHP warning, WordPress cannot process it correctly.
That’s when you might see messages like:
- The response is not a valid JSON response.
- Updating failed. The response is not a valid JSON response.
- Publishing failed. The response is not a valid JSON response.
The error doesn’t necessarily mean your image or blog post is corrupted. It usually indicates a communication problem between WordPress and your server.
Why Does WordPress Show an Invalid JSON Response Error?
Before trying different solutions, it’s worth understanding the possible causes.
Here are some common reasons:
- REST API problems: WordPress cannot communicate properly with its REST API endpoints.
- Incorrect permalink settings: Broken rewrite rules can prevent REST API requests from reaching WordPress.
- HTTPS configuration issues: Incorrect website URLs or HTTP/HTTPS redirects can interrupt requests.
- Plugin conflicts: Security, caching, or optimization plugins may interfere with REST API requests.
- Firewall restrictions: Hosting firewalls, security plugins, or CDN settings might block API requests.
- PHP errors: Unexpected warnings or fatal errors can interfere with the response.
- Image processing issues: Problems with Imagick or GD may prevent WordPress from processing uploaded images.
The actual cause varies from one website to another. Therefore, I recommend troubleshooting the underlying issue instead of installing random plugins.
How to Fix “The Response Is Not a Valid JSON Response” in WordPress
Try the following solutions in order. After each step, return to Gutenberg and check whether you can upload an image or publish your post successfully.
Fix 1: Check Whether the WordPress REST API Is Working
This is one of the first things I recommend checking.
Open a new browser tab and visit the following URL:
https://yourwebsite .com/wp-json
Replace yourwebsite .com with your actual domain name.
If the REST API is working correctly, you should see structured JSON data containing information about your WordPress website.
However, if you receive a 403 Forbidden, 404 Not Found, 500 Internal Server Error, or an HTML error page, something might be interfering with the REST API.
You can also check this from your WordPress dashboard:
- Navigate to Tools → Site Health.
- Open the Status tab.
- Look for REST API-related errors.
- Expand the error details to understand what went wrong.
If Site Health reports a REST API error, investigate the reported endpoint and HTTP status before proceeding.
Fix 2: Reset Your WordPress Permalink Settings
Incorrect permalink or rewrite configurations can prevent WordPress REST API endpoints from working correctly.
Fortunately, you can refresh your permalink settings without changing your existing URL structure.
Follow these steps:
- Navigate to Settings → Permalinks.
- Check your current permalink structure.
- Scroll down and click Save Changes without modifying anything.
- Clear your website cache if you use a caching plugin.
- Return to Gutenberg and try uploading the image again.
This forces WordPress to refresh its rewrite rules.
If the issue persists, your server’s rewrite configuration might need further investigation. Contact your hosting provider before manually editing server configuration files.
Fix 3: Check Your WordPress Website URLs and HTTPS Settings
An incorrect website URL or SSL configuration can sometimes interfere with REST API requests.
For example, your website might use HTTPS, but WordPress could still have an HTTP address configured.
To verify this:
- Open your WordPress dashboard.
- Navigate to Settings → General.
- Check the following fields:
- WordPress Address (URL)
- Site Address (URL)
- Ensure both addresses use the correct HTTPS version of your website.
- Check whether your website consistently uses the www or non-www version.
For example, if your preferred website address is https://www.example.com, make sure your WordPress configuration and redirects are consistent with that address.
Important: Don’t change these settings blindly. An incorrect URL change can make your WordPress dashboard inaccessible. If your website uses a custom domain or proxy configuration, verify the correct setup with your hosting provider.
Fix 4: Check for Plugin or Theme Conflicts
Sometimes, a plugin or theme interferes with WordPress REST API requests.
Security, caching, and optimization plugins are particularly worth investigating.
To identify a possible conflict:
- Create a backup of your website.
- Temporarily deactivate your plugins.
- Return to Gutenberg and test the image upload or publishing process.
- If the error disappears, reactivate your plugins one at a time.
- Test after activating each plugin until you identify the possible conflict.
If deactivating plugins doesn’t resolve the issue, temporarily switch to a default WordPress theme using a staging environment.
If the error disappears after changing themes, investigate your active theme’s functionality.
Avoid leaving your security plugins disabled on a live website. Use a staging environment whenever possible.
Fix 5: Check Your Security Plugin, Firewall, or CDN
Your website might have a firewall or security configuration that blocks REST API requests.
For example, security plugins, hosting-level firewalls, and Cloudflare security rules can sometimes interfere with requests to /wp-json/.
If you use a security plugin or CDN:
- Check its firewall or security logs.
- Look for blocked requests involving
/wp-json/. - Temporarily test the relevant security rule using a safe staging environment.
- If a request is being blocked, ask your hosting provider or security plugin support team to investigate.
Don’t disable your entire firewall or permanently whitelist every REST API request without understanding the security implications.
Fix 6: Check PHP Errors and Server Logs
If none of the above solutions works, investigate your website’s PHP errors.
Sometimes, a plugin, theme, or custom code generates PHP warnings or fatal errors that interfere with the JSON response.
You can start by checking:
- WordPress Site Health.
- Your hosting control panel’s PHP error logs.
- WordPress debug logs, if debugging is enabled.
You can also inspect the failed request through your browser’s Developer Tools.
Open Developer Tools → Network, reproduce the error, and look for the failed request containing /wp-json/.
Check its HTTP status and response body. This can help identify whether the response contains an HTML error page, PHP warning, redirect, or firewall message.
If you’re unfamiliar with PHP debugging, ask your hosting provider to investigate the relevant server logs.
Fix 7: Switch From Imagick to GD for Image Processing Issues
WordPress supports different image-processing libraries, including Imagick and GD.
Sometimes, Imagick-related compatibility or processing issues can interfere with image uploads.
In such cases, using GD instead of Imagick may help.
You can first check which image-processing extensions are available on your server:
- Navigate to Tools → Site Health.
- Open the Info tab.
- Expand the Media Handling section.
- Check whether Imagick and GD are available.
If you suspect an Imagick-related issue, contact your hosting provider and ask whether they can investigate or temporarily configure GD for image processing.
There is also an older open-source plugin called Default to GD, which changes WordPress’s default image-processing library to GD.
However, its repository dates back to 2012 and lists compatibility only up to WordPress 3.5. I wouldn’t recommend installing it on a modern WordPress website without independently verifying its compatibility and safety.
GD is worth investigating when the problem is related to image processing, but it won’t fix unrelated REST API or firewall issues.
Fix 8 – Avoid Error While Uploading the Images in WordPress
This is even simpler; all you need to do is install a plugin available on GitHub, and the error will be no more.
Step 1. Download the Default to GD plugin WordPress Plugin

Step 2. Install the plugin in your WordPress Site…
Step 3. You are all set, no changes required at all.
One of the workarounds will solve the issue of uploading an image.
Temporary Workaround: Upload Images Through the Media Library
If you need to continue writing your blog post while investigating the issue, try uploading images directly through the Media Library.
This was one of the workarounds that helped me when I originally encountered the error.
Follow these steps:
Step 1: Open your Gutenberg editor and select the Add Image option from the image block.
Step 2: Instead of uploading the image directly, select Media Library.

Step 3: Switch to the Upload Files tab.
Step 4: Click Select Files and choose an image from your computer.
Step 5: Once uploaded, select the image and insert it into your post.
This alternative upload route worked for me, even when the regular Gutenberg upload process was failing.
However, it’s only a workaround. It doesn’t necessarily resolve the underlying REST API or server issue.
Does Switching to the Classic Editor Fix the JSON Response Error?
Another option is temporarily switching to the Classic Editor. You can install the official Classic Editor plugin and use the traditional WordPress editing interface.
However, switching editors shouldn’t be considered a permanent fix for an invalid JSON response error. The underlying problem might still exist because other WordPress features and plugins also depend on the REST API.
I recommend investigating the actual cause instead of abandoning Gutenberg altogether. The plugin method will solve all the image error that happens while uploading a picture on your WordPress site.
Frequently Asked Questions
1. Why does WordPress say the response is not a valid JSON response?
WordPress displays this error when the block editor receives an unexpected response instead of valid JSON from the REST API. Common causes include broken permalinks, plugin conflicts, firewall restrictions, incorrect website URLs, and PHP errors.
2. How do I fix an invalid JSON response in Gutenberg?
Start by checking the WordPress REST API, resetting permalink settings, and verifying your website’s HTTPS configuration. If the issue continues, investigate plugin conflicts, security restrictions, and server logs.
3. Can a plugin cause the invalid JSON response error?
Yes. Security, caching, and optimization plugins can sometimes interfere with REST API requests. Temporarily deactivate plugins in a staging environment to identify potential conflicts.
4. Why can’t I upload images to WordPress?
Image uploads can fail because of server restrictions, file size limits, incorrect permissions, image-processing issues, or REST API problems. Check your Site Health information and hosting error logs to identify the cause.
5. Can I use the Classic Editor instead of Gutenberg?
Yes. You can use the Classic Editor plugin as a temporary alternative. However, it doesn’t necessarily resolve the underlying REST API issue.
Final Thoughts
The “response is not a valid JSON response” error can be frustrating, particularly when you’re in the middle of writing a blog post.
However, it doesn’t always require a new plugin or a complete change of editor.
Start by checking the REST API and permalink settings. If those aren’t responsible, investigate HTTPS configuration, plugin conflicts, security restrictions, and server-side errors.
If you simply want to continue working, uploading images through the Media Library might help as a temporary workaround.
My recommendation: Find the actual cause before applying a workaround permanently. That way, you can resolve the problem without introducing unnecessary plugins or compromising other WordPress functionality.
