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.
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:
- go to settings > permalinks and save them again
- if you’re using nginx for server, make sure that wordpress rules are added to nginx, if not then add them
- 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.
Note sure, above one didnt solve my issue. But enabled “https” in wp-config.php (WP_HOME and WP_SITEURL) and issue resolved.
Thank you Gini. I have updated the article and included this tip to turn on ssl for wp_home and wp_siteurl in wp-config.php file too.
Does not work for me, I use nginx and auto SSL from cloudflare
Did you setup permalinks settings for nginx? You can verify that permalinks are working on your site to make sure that nginx configurations for WordPress are working fine. You can check the basic nginx WordPress configurations required here: https://wordpress786.com/wordpress-nginx-configurations/
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.
NOT SURE WHY THIS IS IN ALL CAPITALS. IT MAKES ME FEEL UNCOMFORTABLE!!!! BUT CAN CONFIRM. hitting save on the permalinks page works for me. litespeed server on plesk
Thanks for pointing out. Fixed the bug now.
I keep getting this issue, and can only solve it by switching to a new network. I have now run out of networks to use.
Do you have any idea how I can get back in to edit when It locks me out?
Which network did you shift from and to?
Updating Permilnk to “Plain” does worked. But I think we are compormising to fix this issue. Plain Permlink doesnt looks good.
Indeed, the primary issue needs to be fixed in each case.
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.
Thank you for addressing this error with such a thorough set of answers. I was worried solving my Update failed issue would take a long time. With your tip to reset permalinks, the problem resolved very quickly. Thank you again for posting this.
I tried hitting the save button in Settings>Permalinks , but this did not help me. I have mod_rewrite enabled and also the wp-config requirements are also there.
I am still getting the error. If you could please help me out.
Please check your email. Let me know if you want me to fix it for you.
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.
Please check your email. Let me know if you want me to fix it for you.
One solution is there, go to posts, select quick edit then change the slug, and save it. This perfectly working for me. The issue is related to permalink saving.
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!
Sorry to see that you’re still having this issue. Please let me know if you want me to look into it for you.
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.
Thanks for updating, you can request your hosting to only disable wordpress related rules in mod_security
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
Please let me know if you want me to look into this issue on your site.
Thank you @TheRiddler
Your solution worked for me
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 🙂
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.
I started experiencing this issue on my dev site recently. Have tried resetting permalink setting, but it does not resolve the issue. Checking with my ISP if Mod_Rewrite is enabled.
Did you solve it? Was the issue related to mod_rewrite?
Many thanks! For me it was as simple as going to Settings>Permalinks, not changing a single thing, and hitting the “Save Changes” button. Completely fixed the problem. How obscure!
Glad to know that it was helpful 🙂 Thanks for updating!
The same as above…
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 🙁
We can have a live session and discuss the issues that you’re having and fix them. Check your email please.