How to Fix the Invalid JSON Error in WordPress (Beginner’s Guide)

admin

imageRunning into an invalid JSON error in WordPress can be frustrating, especially when you’re in the middle of editing posts or pages.

This error pops up with a message saying, “The response is not a valid JSON response,” preventing you from updating your content.Such errors can disrupt your workflow and make website management more challenging.

Do note that they often stem from communication issues between your browser and the WordPress server.

Having managed WordPress sites for over 16 years, we’ve faced these frustrations firsthand.We’ve navigated through these errors countless times and are here to share proven solutions that work.

In this guide, let’s go through tips and tricks for how to fix the invalid JSON error in WordPress.

What Causes the ‘Not a Valid JSON Response’ Error in WordPress?

Failure to receive an expected response from the server causes the ‘Not a valid JSON response’ error in WordPress.

Basically, WordPress needs to communicate with the server while you are editing a blog post.It relies on getting responses from the web hosting server in the background.This response is usually in JSON format, which is used to quickly transport data using JavaScript.

If, for some reason, WordPress fails to get the response or the response is not in JSON format, then you will see the ‘Not a valid JSON response’ error.

This error could appear for a number of reasons.However, the most likely cause is incorrect URL settings in WordPress or broken permalinks.

With that in mind, we’ll show you how to easily fix the invalid JSON error in WordPress.You can use these quick links to jump to the different methods:

[Option 1.

Check WordPress URLs in Settings](#aioseo-1-check-wordpress-urls-in-settings)[Option 2.

Fix WordPress Permalink Structure](#aioseo-2-fix-wordpress-permalink-structure)[Option 3.Regenerate WordPress .htaccess File](#aioseo-3-regenerate-wordpress-htaccess-file)[Option 4.View the REST API Debug Log](#aioseo-4-view-the-rest-api-debug-log)[Option 5.Deactivate All WordPress Plugins](#aioseo-5-deactivate-all-wordpress-plugins)[Option 6.

Temporarily Switch to the Classic Editor](#aioseo-6-temporarily-switch-to-the-classic-editor)[Option 7.Switch to a Default WordPress Theme](#aioseo-7-further-troubleshooting)[Option 8.Temporarily Turn Off Your Website Application Firewall](#aioseo-option-8-temporarily-turn-off-website-application-firewall)[Option 9.Turn On Debugging in WordPress](#aioseo-option-9-turn-on-debugging-in-wordpress)[Option 10.

Check for Mixed Content Error](#aioseo-option-10-check-for-mixed-content-error)[Final Step: Seek Expert Help](#aioseo-final-step-seek-expert-help)

Note: Please make a complete WordPress backup before making any big changes to your website.This allows you to easily restore your website to its previous state.

Ready? Let’s get started!

Option 1.Check WordPress URLs in Settings

First, you need to make sure that your WordPress Address and Site Address settings are correct.

Simply go to Settings » General page.From here, you need to review the ‘WordPress Address (URL)’ and ‘Site Address (URL)’ fields.

For most websites, this setting must have the same URL in both fields.

However, rarely, some WordPress users may have given WordPress its own directory and serve the website on a different address.

In that case, they can have different URLs here.

However, if your Site Address is incorrect, then that will trigger the invalid JSON error in WordPress.

If you made any changes to the settings, then don’t forget to click on the ‘Save Changes’ button.

You can now edit a blog post and see if adding any new blocks or saving that post triggers the ‘Not valid JSON response’ error.

If you are still seeing the error, then continue reading.

Option 2.Fix WordPress Permalink Structure

WordPress comes with an SEO-friendly URL structure that allows you to use human-readable URLs for your posts and pages.

However, sometimes, a user may mess up the permalink settings.This would make it impossible for the WordPress block editor to get a valid JSON response and cause the error to appear.

To fix this, you need to simply visit the Settings » Permalinks page.

From here, you must carefully review the permalink options.

If you are unsure whether you are using the right settings, then simply select one of the default formats.

After that, go ahead and click on the ‘Save Changes’ button to store your settings.

You can now try editing a blog post or page to see if the error has disappeared.If it hasn’t, then you can try this next step.

Option 3.Regenerate WordPress .htaccess File

The .htaccess file in WordPress is used as a configuration file to manage SEO-friendly URLs (permalinks).

Normally, WordPress can automatically regenerate and update the file.You can also trigger that update by simply clicking on the ‘Save Changes’ button at the bottom of the Settings » Permalinks page.

However, sometimes, it may not get updated or have incorrect settings.This will affect your WordPress permalinks and may also cause an invalid JSON response error.

To fix this, you will need to connect to your website using an FTP client or the file manager app in your WordPress hosting account dashboard.

Once connected, you need to locate the .htaccess file in the root folder of your website and download it as a backup to your computer.

Expert Tip: Can’t locate the .htaccess

file? Then you can see this quick article on how to find .htaccess file.

After that, you need to edit the .htaccess

file using an FTP client or the file manager app.

Once the file opens, you need to delete all the code inside it and replace it with the following code:

# BEGIN WordPress

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]

# END WordPress

Don’t forget to save your changes and upload the file back to your website.

You can now visit your website and edit your post or page to see if you can reproduce the invalid JSON response error.

If you are still seeing the error, then there are a few more steps you can take.

Option 4.

View the REST API Debug Log

The invalid JSON response error can also mean that the WordPress REST API on your website encountered an error.

The REST API is the set of techniques WordPress uses to communicate with the web server as you work on your website.

You can see details of this error in the ‘WordPress Site Health’ tool.Simply visit the Tools » Site Health page.

From here, you may see an issue labeled ‘The REST API encountered an unexpected result’.

Clicking on it will show you more details, which may give you some clues about which plugin or third-party service is causing the issue.

If this doesn’t provide any clues, then you can move on to the next step.

Option 5.

Deactivate All WordPress Plugins

Occasionally, WordPress plugins may conflict with each other or the WordPress core software.This can result in unexpected behavior and could be a potential reason for the invalid JSON error.

Simply go to the Plugins » Installed Plugins page.From here, select all your WordPress plugins and then choose ‘Deactivate’ from the ‘Bulk Actions’ drop-down menu.Now, click the ‘Apply’ button to continue.

WordPress will now deactivate all your installed plugins.

You can now try again to reproduce the error.If the error disappears, then this means one of the plugins installed on your website was causing it.

To figure out which plugin is the problem, you just need to activate them one by one and try to reproduce the error.Repeat this until you find the culprit.

After that, you can reach out to the plugin author for support or find an alternative plugin.

Option 6.Temporarily Switch to the Classic Editor

The next option is to temporarily switch to the Classic Editor for WordPress.

This older version of the WordPress editor uses a simpler text editor and doesn’t rely heavily on REST API to get JSON responses.

To use it, you need to install and activate the Classic Editor plugin.For more details, see our step-by-step guide on how to install a WordPress plugin.

The plugin works out of the box and will disable the Gutenberg editor upon activation.

Alternatively, you can use WPCode to disable the Gutenberg editor and activate the classic editor safely.

It’s the easiest and safest plugin to use for inserting code snippets in WordPress.

Feel free to read this guide to find out how to disable Gutenberg with WPCode.

You can now continue working on your website and get back to troubleshooting later.

Option 7.Switch to a Default WordPress Theme

Third-party WordPress themes can sometimes introduce conflicts with the WordPress core or other plugins, especially if they’re not well-coded or maintained.

These conflicts can show up in various ways, including invalid JSON errors.

By switching to a default theme, you’re essentially removing any custom code or functionalities introduced by your current theme.

This helps isolate whether the issue originates from the theme itself or something else in your WordPress setup.

To do this, you’ll want to navigate to Appearance » Themes in your WordPress dashboard.Then, find a default theme like Twenty Twenty-Four or Twenty Twenty-Three and click ‘Activate.’

Option 8.Temporarily Turn Off Your Website Application Firewall

If you are using a WordPress firewall like Cloudflare, Sucuri, or a plugin, then it may sometimes block legitimate requests, too.

The easiest way to figure this out is temporarily disabling your WordPress firewall plugin or service.

Some application-level WordPress firewalls can be disabled by simply deactivating the plugin.You can disable DNS-level firewalls like Sucuri and Cloudflare from your account dashboard.

Option 9.Turn On Debugging in WordPress

WordPress has a built-in feature for keeping a log of errors.However, it is not enabled by default.

To turn it on, you need to add the following code to your wp-config.php file:

define( ‘WP_DEBUG’, true );

define( ‘WP_DEBUG_LOG’, true );

After that, WordPress will log all errors in a debug.log

file located inside the wp-content

folder.You can access this file by using an FTP client.

The error log may provide you with a clue about what is causing the invalid JSON error on your website.

For more details, see our guide on setting up WordPress error logs and using them to debug errors.

Option 10.Check for Mixed Content Error

When a website served over HTTPS (secure) tries to load resources (images, scripts, data) from an insecure HTTP source, it creates a mixed content error.

Modern browsers block mixed content for security reasons.This prevents attackers from injecting malicious content into a secure website through an insecure resource.

If the blocked resource happens to be a JSON file or a script that fetches JSON data, the browser might not be able to access it completely.This incomplete or blocked data can then lead to parsing errors, resulting in an invalid JSON error.

To find out how to solve it, you can read our guide on how to fix the mixed content error in WordPress.

Final Step: Seek Expert Help

Finally, if all else fails, then this could be due to a misconfiguration on your WordPress hosting server.Most reliable WordPress hosting companies are able to help users with common WordPress issues.

Simply reach out to them via live chat or support ticket, and they may be able to help you fix it.

You can read our guide on how to properly ask for WordPress support for more information.

💡 Having trouble with your WordPress site? No need to stress! We’re on standby to assist! Our skilled Emergency WordPress Support team can help you resolve any issue and get your site running smoothly in no time.

Say goodbye to long-term contracts.Enjoy fast, one-time fixes tailored just for you.

Reach out today and leave the problem solving to us!

We hope this article helped you learn how to fix the invalid JSON error in WordPress.You may also want to see our guide on how to fix the “Destination Folder Already Exists” error, along with our complete handbook of the most common WordPress errors.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials.You can also find us on Twitter and Facebook..

Leave a Reply

Your email address will not be published. Required fields are marked *

Next Post

F90D – Overview

Get up to speed faster and smarter in your new role Transitions are vulnerable times.When you’re a leader taking on a new role, your early actions have a decisive impact on your success or failure.In addition, transitioning today can be even more complex given the new possibilities of working virtually.How […]
F90D – Overview

Subscribe US Now