Find out how to Repair an Invalid JSON Error in WordPress

Not like different errors, and invalid JSON error in WordPress is easy to know and repair. For the unaware, this seems when WordPress can’t talk with the online server whilst you work inside the Block Editor. The server’s responses come within the JSON format, which explains the error.

Fixing the difficulty shouldn’t take quite a lot of minutes, and might be one of many following:

One in all these would be the resolution, though the hope is that you simply gained’t want to have a look at all of them. We’re presenting the 5 options right here from best to hardest, though that’s relative as you’ll probably have the abilities you might want to sort out every one very quickly.

1. Carry Out Some Easy Steps to Diagnose the Error

Earlier than you dig round in settings screens, you’ll wish to guarantee you aren’t the reason for the invalid JSON error in WordPress. Nonetheless, create a full backup of your web site first in case you might want to reinstate your web site later.

After you have a backup within the bag, look to tick off all the following ‘gotchas’:

  • Change to a default theme, in case your main one has a fault.
  • Flip off your Internet Software Firewall (WAF), in case you use one. It could possibly be that you simply’ll disable your safety plugin as an entire on a brief foundation.
  • Talking of which, it’s a good suggestion to deactivate and reactive your plugins to see if one is the reason for the invalid JSON error in WordPress. This can be a typical troubleshooting step inside the platform, and may generally highlight a problem with a rogue plugin.
  • Strive utilizing the Traditional Editor, to see in case you can nonetheless obtain what you want with out seeing the error. Nonetheless, you shouldn’t think about this a everlasting repair, extra scraping the rust off of a defective engine.

Should you don’t have WordPress’ debug mode energetic, you must also do that so you may attempt to catch the fault of the error. Nonetheless, it’s probably going to be one of many under options, they usually gained’t take too lengthy to resolve.

2. Verify Your WordPress URLs

For the primary methodology, you’ll wish to log into WordPress and head to the Settings display:

On the Normal tab, take a look at the 2 fields that learn WordPress Deal with (URL) and Website Deal with (URL). Within the overwhelming majority of instances, they would be the similar because the area title in your web site:

The fields for the WordPress Address URL and the Site Address URL.

You’ll probably know in case your have WordPress underneath a unique listing that might clarify a transparent distinction right here. Nonetheless, a distinction WordPress doesn’t perceive will set off the invalid JSON error.

It could possibly be that these URLs use the incorrect HTTP protocol: When you have a Safe Sockets Layer (SSL) certificates, every URL ought to use https://. Our recommendation is to verify for spelling errors in every URL, and likewise verify whether or not every ones makes use of the suitable protocol.

When you make any fixes, save your adjustments and verify for the error. If it nonetheless crops up, head to the subsequent methodology.

Whilst you’re within the Settings web page, head to the Permalinks tab. There could possibly be a problem underneath the hood along with your permalink construction that might trigger the invalid JSON error in WordPress.

Wordress' Permalink Settings screen.

The answer right here is straightforward:

  • Select a permalink sort. Until you employ a Customized Construction, persist with the present choice on this web page.
  • Save your adjustments. This can ‘relaxation’ your permalink settings, and may rid you of the invalid JSON error in WordPress.

Nonetheless, in case you use a customized permalink construction, ensure there aren’t any spelling errors or syntax errors with the tags you employ:

The WordPress Post name and Custom Structure fields.

Even one character misplaced will trigger the error, so look to repair something you see, save your adjustments, and verify for additional points.

4. Take a Have a look at the Website Well being Log for Clues

WordPress features a useful display that will help you decide how ‘wholesome’ your web site is. The Website Well being web page is actually a listing of crucial points and beneficial enhancements to assist with features of your web site. For instance, you may optimize efficiency, work in your Search Engine Optimization (web optimization), and extra:

WordPress' Site Health screen.

Should you encounter the invalid JSON error in WordPress, you might even see one other beneficial enchancment: “The REST API encountered an sudden consequence”. This could offer you some indication of the place the JSON error lies, and from there you may examine additional.

Nonetheless, in case you don’t have a lot expertise studying error logs like this, you would possibly wish to contact your host. This manner, they will let you know what the difficulty pertains to, and whether or not it’s one thing on the server facet.

5. Rebuild Your .htaccess File

The ultimate methodology to resolve the invalid JSON error in WordPress is the hardest, however nonetheless easy. Your .htaccess file is a set of configurations for Apache servers.

Not like Nginx, Apache customers can deal with server configurations. As such, this might trigger an invalid JSON error in WordPress.

The perfect strategy right here is to rebuild the .htaccess file itself, which is straightforward to do. In actual fact, you might have already performed this when altering your permalink settings, as saving your adjustments right here regenerates the .htaccess file.

Nonetheless, you would possibly wish to create a clear file your self from scratch, to make certain you don’t introduce an error or maintain one round.

First, you’ll wish to make a backup of your previous .htaccess file. To do that, we suggest utilizing Safe File Switch Protocol (SFTP) to entry your server and drag the .htaccess file to your native pc. Right here’s what you’ll want:

Administrative entry to your server, and the login credentials. You’ll be able to typically discover these inside your internet hosting management panel, or in an e-mail out of your host.

Your .htaccess file might be within the root of your web site’s main listing, and the method is to tug it out onto your pc (and set for hidden recordsdata to indicate):

A SFTP client showing a WordPress directory that contains a .htaccess file.

From right here, make a reproduction in your pc, filter the contents, and add the next:

# 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

This can be a default .htaccess file. Put it aside as .htaccess, then add it to your server once more. From right here, verify for the error.


The invalid JSON error in WordPress is straightforward to know and repair, which is nice if you might want to proceed working in your web site in a rush. Many of the options to this error relate to a configuration setting in your server, so that you’ll poke round inside WordPress’ settings screens to resolve it.

In some instances, you’ll must rebuild a .htaccess file from scratch, however even that is friction-free. Nonetheless, in case you nonetheless see the error in your web site, it’s a good suggestion to contact your host for additional recommendation. There could possibly be one thing on the server that doesn’t play properly along with your web site’s configuration that they might want to look into.

Do you endure from the invalid JSON error in WordPress, and does one in all our options make it easier to? Tell us within the feedback part under!