Updating failed. The response is not a valid JSON response in WordPress

In this article, i sharing a WordPress JSON response problem faced while publishing a post through WordPress. As usual, i wrote everything that i wanted to share for my readers and i tried to preview my post, suddenly an error alert appeared showing:

Updating failed. The response is not a valid JSON response

Also read: How to Highlight Text in WordPress Posts [Gutenberg Editor]

I have gone through many errors and fixes in this long time journey. This time also, this error is fresh to me. I have found may other people also went through the same “not a valid JSON response” error when trying to publish their content.

Also, i found different opinions in forums like StackOverflow, Reddit etc. I couldn’t find a solid answer for this error. So with past experiences, i decided to give a try and i have managed to solve the issue.

WordPress seems to do a JSON post when publishing a new post/page so I checked the network tab in my Developer Tools. If you check the “response” tab for this JSON call you might see some more details about this invalid JSON response.

In my case it was due to a web server configuration:

You have to setup proper rewrite rules for server to write files properly. Please follow the options below for different server configurations.

Popular:

Apache Server

AllowOverride None

Changed it to :

AllowOverride All

in

/etc/apache2/apache2.conf

For OpenLiteSpeed Web Server

fix JSON response in wordpress

Open Virtual Hosts

Add Rewrite rules

rewriteCond %{HTTPS} !on
rewriteCond %{HTTP:X-Forwarded-Proto} !https
rewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Conclusion

Since litespeed servers offer more optimisation and caching option than Apache and NGINX for WordPress websites, the number of users of litespeed increasing day-by-day. Unlike Apache and NGINX litespeed offer a GUI dashboard for its configurations making it more user friendly.

Leave a Comment