Everything WordPress - start till end
[Solved] Updating failed. Error message: The response is not a valid JSON response.

[Solved] Updating failed. Error message: The response is not a valid JSON response.

While working on a new WordPress site, I encountered this error. It seemed weird as everything was just brand new (except that I had to move files around though).

The error occurred when I tried to save the draft while creating a new post or when trying to preview the draft.

In fact the preview window also showed 404 not found, instead of showing the preview of the newly created draft post.

I didn’t check the error while publishing the post, but I suspect that it would be the same thing.

Updating failed. Error message: The response is not a valid JSON response.
Updating failed. Error message: The response is not a valid JSON response.

The solution was simple.

I needed to go to Settings > Permalinks and save or update them again.

What caused the json not valid error?

The error was caused by the missing .htaccess file in WordPress root directory. There can be many reasons for that and that’s beyond the scope of this article.

Another issue can be if you’re using nginx server. You need to confiture the wordpress settings in nginx.conf file first and restart the nginx server to make it work properly.

How to fix Updating failed. Error message: The response is not a valid JSON response

Note that this error can also occur with publishing or uploading too.

As the issue is mainly caused by permalink error, steps to fix it include:

  1. go to settings > permalinks and save them again
  2. if you’re using nginx for server, make sure that wordpress rules are added to nginx, if not then add them
  3. restart nginx after adding those rules

However if you’re still having the error or have any other issue, you can contact me to discuss.

Make sure that Mod_Rewrite is enabled

If you have a valid .htaccess file and you’re still facing this issue, then make sure that mod_rewrite is enabled on your apache server.

If mod_rewrite is not available or disabled, then your permalinks won’t work even if you have correct rules in .htaccess file. The site links would work fine if they’re set to plain, but won’t work if they are set to anything else like post-name etc.

Add wp_siteurl and wp_home in wp-config.php (thanks to Gini)

If the above mentioned steps don’t help, then you can try adding the home_url and site_url to the wp-config.php file. This can be the cause of error if your site has any configuration issue (or desired configuration) which cause conflicts like ssl (non https requests on a site running on https), etc.

How to add wp_home and wp_siteurl in wp-config.php

To define home url wp_home and wp_siteurl with ssl (https), go to your wordpress root directory, edit the wp-config.php file and add this on top:

define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );

Remember to replace the domain name example.com with your own domain name and correct path. Also make sure that your site is compatible with ssl / https configuration.

34 Comments

  1. tHANKS! IT WAS THE PERMALINKS! i DELETED AND RE-INSTALLED wORDPRESS, ADDED THE DATABASE AND RESTORED THE THEMES BUT I COULDN’T ACCESS THE BLOG POSTS AND I COULDNT SEE THE COMMENTS. JUST HITTING SAVE ON IN THE PERMALINKS SECTION OF SETTINGS IMMEDIATELY CURED THE PROBLEM.

  2. KC

    Thanks for the article. I did everything you mentioned. I finally submitted a ticket and the support team disabled my Mod security, which fixed the problem. I suspect that it probably related to the APACHE mod-rewrite. So by disabling the “security” it enabled rewrite plus some other changes. So check your security from your web host as well.

  3. I have this “The response is not a valid JSON response” error message when I try to update a page and some of my web pages (which were fine last week) are no longer available to the user, although as administrator I can see the content. As far as I know the only recent change was the automatic updating of Beaver Builder Lite on January 27, 2021. I tried resaving the PermaLinks and adding the DNS A as requested in a message, but I am still having these problems.

  4. i’m also having this issue. i haven’t worked on my site in months. i’ve switched themes, too, though i’ve researched this enough to know it’s a WP issue.

    i’ve disabled any suspect plugins like beaver builder since this WP uses blocks.

    i’ve done the settings > permalinks solution, too, and still having this problem.

    not a web designer! just a photographer and educator who maintains my two sites.

    any help appreciated…assuming i can understand it!

  5. TheRiddler

    Permalinks did not resolve my issue. I continued to get the error.

    Adding wp_home and wp_siteurl to wp_config caused my entire site to slow to a crawl as it kept “transferring data.”

    Thanks to another response, I found “ModSecurity” in my cpanel and disabled it and then the problem went away!

    As a test, I re-enabled ModSecurity and the error came back. So for now, ModSecurity is disabled and I am reaching out to my host to ask what else it does and if Mod_Rewrite is for sure affected by ModSecurity being enabled or disabled.

  6. Tom

    The problem is that I get this error for some pages and not for others. This seems to exclude global settings as suspects. By trial and error I can find which BLOCKS trigger this error, but they look innocent even in plain html

  7. Hi, thank you for the article. It didn’t solve my problem but at least I now know it’s the permalinks issue. By changing them to plain, the problem goes away, but sadly, that’s not a good solution. I tried checking if mod_rewrite and modSecurity are enabled, but I don’t have any experience with cPanel, so … here we are πŸ™‚

  8. I found a comment on WordPress support forum regarding this issue that recommended installing classic editor plugin. Tried that and it solved the problem. So I guess this has something to do with Guttenberg? I’m using Elementor, so I don’t care about Guttenberg but I still don’t like to resolve issues by installing more plugins. If anyone has a more elegant solution, please let me know.

  9. xyz

    Same problem. Wp-config & permalinks & mod-rewrite on server all OK. Switching to classic editor fixes it for a while.
    Thanking of switching to SquareSpace & leaving Wp as broken πŸ™

Leave a Reply

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