Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

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

Are you trying to fix the invalid JSON error in WordPress?

This error appears when editing WordPress posts or pages on your website. You will see a message saying, ‘The response is not a valid JSON response’, and updating that page will fail.

In this article, we will show you how to easily fix the invalid JSON error in WordPress. We will also talk about why this error occurs and how to avoid it in the future.

JSON response is not valid 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.

Not valid JSON response error displayed in WordPress

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

That being said, let’s take a look at how to easily fix the invalid JSON error in WordPress. You can use these quick links to jump to the different methods:

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.

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.

WordPress URL settings

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.

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.

Fix permalinks in WordPress

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 has 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.

Download .htaccess file as a backup

Tip: Can’t locate the .htaccess file? 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.

Edit .htaccess file

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 and 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. Visit the Tools » Site Health page.

REST API issue in WordPress

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.

Deactivate all plugins

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 it 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.

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 error.

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, navigate to Appearance » Themes in your WordPress dashboard. Then, find a default theme like Twenty Twenty-Four or Twenty Twenty-Three and click ‘Activate.’

Activating a default WordPress theme

Option 8. Temporarily Turn Off Website Application Firewall

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

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

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

Option 9. Turn On Debugging in WordPress

WordPress comes with a built-in feature that allows you to keep 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 keep a log of 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 may be causing the invalid JSON error on your website. For more details, see our guide on setting up WordPress error logs and using them for debugging 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 the mixed content error.

Modern browsers block mixed content for security reasons. This is to prevent attackers from injecting malicious content into the secure website through the 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, 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.

We hope this article helped you learn how to fix the invalid JSON error in WordPress. You may also want to see our complete handbook of the most common WordPress errors and how to fix them, along with our top picks for the best email marketing services for a small business.

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

43 CommentsLeave a Reply

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Martyn Willes

    we had been using the WP for posting for about three months with no problem before the error message arrived and posting stopped. Solution 1. fixed the problem for us but I did not see any explanation as to how the URL could have changed all by itself, for example was it because of a software update, adding a new user, or something else?

    • WPBeginner Support

      It is difficult to say as there are multiple possible ways that it could have happened. Sometimes it could be a bad update while other times it could be something from your hosting provider triggered the change that caused the issue. There is no universally correct reason.

      Admin

  3. Denis

    Very good contribution. The solution to a similar problem in our case was to adjust the configuration of the Apache web server module “modSecurity”. ModSecurity has very restrictive default settings for JSON requests.

  4. Tim Hordo

    I solved this for my website by simply removing the apostrophe from the name of the file I was trying to upload.

    • WPBeginner Support

      Thanks for sharing that should someone else run into that issue :)

      Admin

  5. Tomas Svitorka

    Amazing article and helped me fix this annoying issue right away! FYI – my solution was simply to regenerate the htaccess file!

    • WPBeginner Support

      Glad to hear our guide was helpful!

      Admin

  6. Ram

    #3 worked for me!! (simply clicking on the ‘Save Changes’ button at the bottom of Settings » Permalinks page.)

    Thanks for publishing such helpful blogs!

    • WPBeginner Support

      You’re welcome! Glad to hear you were able to solve the error!

      Admin

  7. Benjamin

    It sounds weird.
    I did a test by creating new article and publishing it with a “Test” title and “Test” body … It worked.
    But when I started to copy/past the content I wanted.. Json appear again.

    • WPBeginner Support

      If you mean you followed these steps and it appeared again then you would want to start from step 4 for fixing the issue!

      Admin

      • Benjamin

        Classic editor solution worked well. :) thanks :)

  8. Chris

    In my case, the issue was the uploaded image dimensions. Anything above 2000 pixels was causing the error.

    • WPBeginner Support

      Thank you for sharing what was the cause of the error for you. If you did not try it, you should be able to increase the maximum upload limit for your site to prevent image sizes being an issue in the future.

      Admin

  9. Angie

    Thank you, after installing an SSL some pages were bringing up the 404. This helped me realize I needed to change http:// to https:// in General settings and it fixed the problem.

    • WPBeginner Support

      Glad our article was helpful!

      Admin

  10. matt

    Thank you for the detailed instructions on how to fix this json error in wordpress. I tried all above ideas to fix. None of them worked. The solution I found was turning off mod security in hosting control panel (cpanel).
    Thanks

    • WPBeginner Support

      Thank you for sharing what worked for you!

      Admin

  11. Brad Cathey

    One can also be using a deprecated or non-existing WordPress function.

    This has happened to me twice, both times when saving a page in the editor. I systematically commented out functions in functions.php, and eventually, the error stopped. The offending function was something I scrapped off someone’s blog without really understanding it. So, be careful.

    • WPBeginner Support

      Thank you for sharing this for anyone looking for the root of the issue on their site!

      Admin

  12. Witt

    I was having this issue and narrowed it to to trying to save anything containing the content “delete it.”

    I haven’t dug in to verify this, but I’m pretty sure Apache mod_security is triggering on that content, thinking it’s part of a sql injection attack and blocking the request.

    I just reworded my content to avoid that phrase. If that’s not an option, you can disable mod_security or write an exception.

    • WPBeginner Support

      Thanks for sharing another possible reason why users could run into this issue!

      Admin

  13. Mike

    Really good article thanks. Life saver ;-)

    • WPBeginner Support

      Glad we could help solve this issue!

      Admin

  14. Letowon Saitoti Abdi

    Changing the lines in the .htaccess was the magic for me, thanks a bunch.

    • WPBeginner Support

      Glad our recommendation was helpful!

      Admin

  15. Alex Slaets

    I had another, stupid cause: mod_rewrite was not enabled in apache configuration. enabling it fixed the error.

    • WPBeginner Support

      Thanks for sharing this should someone else run into this issue!

      Admin

  16. Chris J

    If you are using IIS, you need to make sure “OPTIONS” is permitted as one of your “HTTP VERBS”.

    Launch Internet Information Service (IIS) Manager at Windows Start > All Programs > Windows Administrative Tools.
    In IIS Manager, expand SERVERNAME > Sites > click example.com > Handler Mappings (under IIS).
    Find the handler which is used by the website and double-click on it.
    Double-click on your PHP handler (there may be more than one listed)
    Click Request Restrictions….
    Switch to the Verbs tab.
    Add required verbs in to the verbs field, for example:
    GET,HEAD,POST,OPTIONS
    Click OK to apply the changes in both windows.

    • WPBeginner Support

      Thank you for sharing this for those using IIS, for most users we would normally recommend reaching out to your hosting provider for this level of modification :)

      Admin

  17. Hussain

    Thanks, number 2 worked for me.

    • WPBeginner Support

      Glad our guide was helpful!

      Admin

  18. Michael Kumsa

    Thanks a lot, I just finished a $25K project, and this site helped me a lot! Love ya!

    • WPBeginner Support

      Glad our content was helpful!

      Admin

  19. Adri

    Great help, thanks a lot!!

    • WPBeginner Support

      Glad we could help you fix the error :)

      Admin

  20. Alex

    Thank so much for your help

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  21. Abadat Ali

    My site error:
    Updating failed. The response is not a valid JSON response
    I solved my error from this instructions;
    Fix WordPress Permalink Structure
    Thank you this helping.

    • WPBeginner Support

      Glad our guide was able to help you solve the issue :)

      Admin

  22. Sholly Young

    Hi, thank you for this detailed write up, I’ve read through it and find it so detailed and insightful.

    However, I have an unanswered question which is this:
    Could this error be as a result of invalid or expired SSL certificate?

    • WPBeginner Support

      That can cause different errors but this specific error would not normally be caused by an SSL certificate.

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.