Have you ever been faced with WordPress error Publishing failed or “The response is not a valid JSON response” in WordPress? This issue can be frustrating and annoying especially when you can not publish a new page/post or edit an existing page/post.
The response is not a valid JSON response., Updating failed. The response is not a valid JSON response., or The response is not a valid JSON response.
These errors manifest when you are trying to publish or update your WordPress posts or pages. You may even have seen this error when trying to upload an image to your WordPress website.
In this post, I wish to show you how I resolved this issue for a client’s website recently. You may support us by sharing this article with the share button below on your social media.
This problem occurs to your WordPress site for many reasons which can be related to the following: It can be related to your web server, .htaccess file, SSL certificate, a plugin, a theme, or for another reason. Funny enough, there is a reason that worked outside these enlisted after much troubleshooting. Keep reading to find out.
Here, are some of the effective and proven methods to help you solve this error.
Be it Publishing failed. Error message: The response is not a valid JSON response., Updating failed.
Table of Contents
How to solve Updating or Publishing failed
These steps are definitely going to work the miracle you need as they were all tested but if it does not work, then try the last suggestion in this post. Good luck
1. Update Permalink
Warning: Updating the permalink structure may cause a change in the URL of all your website pages and posts published and as such the previous URLs won’t be accessed as they may display 404. The changes can also affect your website’s SEO.
Hence, you may revert back to the initial structure of the permalink after the test or you may not want to try this method. But if your website is brand new, you don’t have to worry about it.
One of the most common solutions for publishing or updating failed: the response is not a valid JSON response error is to update the permalink structure of your site.
How do you go about it?
Go to your WordPress dashboard, go to Settings and then Permalinks. Then you can click on the Save Changes button to re-save or update the current permalink structure. Then check to see if the error is fixed.
Another thing to do ff the first test doesn’t fix the error then you can go back to the permalink page and then select Plain from under the Custom Settings to change the permalink structure. Click on Save Changes. Now check again to see if the error has been solved.
After all this and the issue isn’t resolved, then revert back to your former permalink structure. Move to the next step the thing you need
2. Use Classic Editor
In research, we discovered that this problem became predominant when WordPress updated its Classic Editor with the new Gutenberg/Block Editor. Since then many have been facing this “Publishing failed. The response is not a valid JSON response.” and “Updating failed. The response is not a valid JSON response.” error.
In short, this was what i did and viola the problem was resolved. Reverting back to the Classic Editor will solve the error. Not just me but many have confirmed this process to resolve their issues. To use Classic Editor, you need to install and activate the Classic Editor plugin on your WordPress website.
However, it is important to note that reverting back to using Classic Editor, it will replace the new Block Editor of WordPress with its old Classic Editor. Thus change how you are used to editing your pages and posts. This may also affect the formatting and layout of your existing pages and posts that have been previously edited using the Block editor. So, you should safeguard your site first by changing a setting in the Classic Editor before you start using it.
How do you safeguard so as not to affect existing pages/post? Once you activate the Classic Editor plugin, go to Settings and then Writing from the WordPress dashboard. Navigate to the settings for the Classic Editor plugin. Choose “Yes” for the option “Allow users to switch editors”. Then click on Save Changes.
Now you have the liberty to use the Gutenberg/Block editor for your existing pages and posts so you won’t have to be concerned about losing existing work in case you want to edit any existing pages or posts on your site. This will also give you the option to edit any new pages or posts with either Block editor or the Classic editor.
Important to note: If you use the classic editor for existing post created with the block, you may lose the post as it will not display. To be safe, ensure to enable the “allow user to switch editor”
I can assure you that this method will fix the issue. Now try creating a new page or post using the Classic Editor and check if the JSON response error has been fixed.
But this doesn’t solve the error, then you can just deactivate the plugin and try out the next solution. But i am somehow sure that this will solve the problem. You can try the next method if this does not solve the issue.
3. Configure SSL
It is important to know that if your website does not have SSL/TLS enabled, web browsers will show a warning message whenever someone tries to visit your website. Such warning can make your site look suspicious and as such you will lose lots of your website visitors. You need to properly set up an SSL certificate for your website in an attempt to solve “The response is not a valid JSON response” error.
Here you can find steps on how you can properly set up your WordPress website to use SSL certificate which is also a very common solution to the JSON response error.
Use SSL Certificate
This is how to check if your site is using SSL certificate by looking at the URL of your website. You can click on your website’s URL to see if the URL starts with HTTPS or HTTP. If it starts with HTTPS and if you see a padlock icon without a cross sign beside the URL, then your site is already configured with SSL certificate. So, you will just need to ensure that your website is using it properly.
You must know that sometimes having no padlock icon doesn’t always mean that an SSL certificate hasn’t been issued on your website. It could just be that your website hasn’t been configured to properly redirect all HTTP traffic to the HTTPS version of your website. To check if that is the case, change your website URL’s HTTP to HTTPS on the web browser and press enter. If the browser now shows a padlock icon beside the URL, then an SSL certificate has been issued for your site but it isn’t configured properly. So, we will need to configure it properly.
If you are using cPanel, Plesk, DirectAdmin, CyberPanel or any other web hosting control panel, you can easily issue an SSL certificate for your website from that web hosting control panel.
Additionally, the validity of SSL certificates expires after a certain period so you may also check if your SSL certificate is still valid. If it is not valid then you should first renew the SSL certificate to fix the SSL-related issues. Once a valid SSL certificate is installed on your WordPress site, you can follow the next steps here to solve Publishing failed. The response is not a valid JSON response. or Updating failed. The response is not a valid JSON response. error.
4. Force HTTPS Redirect
With your Cpanel, you can easily redirect all HTTP traffic to the HTTPS version of your website. There is a slight difference in this method due to different hosting control panels. Locate settings option like TLS/SSL or look for redirect then force HTTPS redirect, redirect HTTP to HTTPS, and so on.
If you think the step is difficult, you can use the Really Simple SSL plugin. You need the step below to help resolve your issue further
Solve Mixed Content Error
We all know that webpages require linking multiple files like CSS, JS, images, etc. to display and function properly. And the links for these files may contain HTTP or HTTPS. If your website is configured to use HTTPS but if some of those links are using HTTP instead of HTTPS, there will be a mixed content error.
The plugin Really Simple SSL plugin can help you solve this problem. Just install it on your WordPress site. This will modify all links on your website to use HTTPS and therefore solve the mixed content error.
You will receive a notification to activate SSL after installing and activating the Really Simple SSL plugin. So, on the notification, click the “Go ahead, enable SSL!” button. But if you don’t see the notification then from your WordPress dashboard, go to Settings and select SSL.
Then you will see the same button saying “Go ahead, activate SSL!”. Once you click on the button it will activate SSL and set HTTPS redirect for your website.
Then you’ll get a warning that reads, “WordPress 301 redirect enabled.” On your specific setup, we recommend enabling the 301.htaccess redirect option.” You’ll notice a link that says “Enable” next to the warning. The plugin’s Settings tab can be accessed by clicking the link. You may also access the same page from your WordPress dashboard by selecting Settings, SSL, and then the Settings tab.
“Enable 301.htaccess redirect” is an option you’ll find here. Activate HTTPS redirection from your.htaccess file by turning on the button next to it. You can also read the warning on how to recover access to your site in the event of a redirect loop issue before enabling the button. After that, click Save after you’ve enabled the button.
You can also navigate to Settings, then General, from your WordPress dashboard. “WordPress Address (URL)” and “Site Address (URL)” will be displayed as a result of this. Check to see if these URLs are HTTPS rather than HTTP.
Check if the JSON response error has been resolved after doing so. If the problem persists, go to Settings > SSL > Settings and turn on the button next to the SSL button.
Now, check if the JSON response error has been fixed. If it hasn’t, then turn off the button beside the “Use alternative method to fix mixed content” option and save the change again then follow the next solution.
Read also:
5. Check Themes and Plugins
If the previous methods don’t work for you then you can try to find out if it is any theme or plugin that is causing the problem. So, from your WordPress dashboard, navigate to Appearance, then Themes. Then activate the default WordPress theme (as of now it is Twenty Twenty) and check if the error is fixed. If not, then revert back to your original theme.
The error may also cause by a plugin and in that case you can deactivate all the plugins on your website and then check again to see if the error occurs. If the error doesn’t occur then it is probably a plugin that is causing the issue. So, to find out which plugin is causing the problem,
6. Restart OpenLiteSpeed
If you are using OpenLiteSpeed web server, then there is a very high chance that a restart will solve your problem.
The open source or free version of the LiteSpeed Web Server is known as OpenLiteSpeed (also known as LIteSpeed Enterprise). One of the major differences between LiteSpeed Enterprise and OpenLiteSpeed is that LiteSpeed Enterprise autodetects changes in .htaccess file and adjusts as necessary in realtime but OpenLiteSpeed can’t do that so it requires restarting for any changes in the .htaccess file to take place.
And because WordPress uses the .htaccess file for many operations, those inactive .htaccess changes in the OpenLiteSpeed server may also cause The response is not a valid JSON response error. If you see this error after adding a new website on your
If you’re utilizing the CyberPanel web hosting interface with OpenLiteSpeed, go to Server Status, then LiteSpeed Status in your CyberPanel dashboard. Then, to restart your OpenLIteSpeed server, select the Reboot LiteSpeed option.
However, if you’re using a different web hosting panel or don’t have one at all, you’ll need to figure out how to restart the OpenLIteSpeed server for your individual setup.
7. Update .htaccess
You can try adjusting your .htaccess file if none of the other techniques work.
You can keep a backup of your original .htaccess file on your computer to ensure that you can revert back to it if something goes wrong. You can download the .htaccess file from your website’s “public html” folder if you know how to use an FTP client or the file manager of your web hosting control panel, such as cPanel, CyberPanel, or others.
If you want an easy solution and want to do everything from the WordPress dashboard then install and activate a file manager plugin like Advanced File Manager on your WordPress website.
Then go to File Manager, then Settings, from your WordPress dashboard. Put a checkbox next to the option to Display.htaccess? and then click Save Changes.
Now go to File Manager to see all of your website’s folders and files. The “.htaccess” file can be found in the “public html” subdirectory of your website. Right-click on the file and click Download to keep a backup of it.
So, now you will be able to easily re-upload the original .htaccess file to the same location in case anything goes wrong.
Now, disable all the plugins on your WordPress site. Then delete the .htaccess file so that we can start from the beginning.
Now, go to Settings and then Permalinks from your WordPress dashboard. Then, make sure the permalink option of your choice is selected and then click on Save Changes. This will create a new .htaccess file for your website.
Alternatively,
Once the file opens, you need to delete all the code inside it and replace it with the following code:
1234567891011 | # 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 |
Remember to save your work and re-upload the file to your website.
You can now go to your website and change a post or page to test whether the invalid JSON response problem can be reproduced.
If the issue persists, there are a few additional steps you can do.
Now you must determine whether or not the error “The response is not a valid JSON response” has been resolved.
If the error has been fixed, then you can turn on one plugin at a time and check if the error occurs again. If the error occurs after enabling a certain plugin then you can just deactivate that one and activate the other plugins as you need.
8. Check Site Health
From your WordPress dashboard, if you go to Tools and then select Site Health, then under the Status tab on that page, WordPress will show you any improvement recommendations that could help your website.
An issue related to Rest API could also cause the JSON response error on your website. Moreover, if you find any issue there, solving the issue might also fix the JSON response error for your website.
9. Fix Image Upload Error
For those that have tried all steps and are here, i admire your patience and wish we could find a solution together soon as i walk you through the next step. If “The response is not a valid JSON response” error still occurs when you try to upload images on your WordPress website, then you can follow the instructions in this section.
Use Media Library Instead of Direct Upload
If you are trying to upload images in an Image block using the Upload button, then you might get the JSON response error but surprisingly many people have found that if they first select Media Library then go to the Upload Files tab and then upload images from there then the error doesn’t occur.
This might be a temporary workaround but it can be helpful if you are in the middle of writing a post or if any other methods don’t work for you.
Remove Invalid Characters
You may also get “The response is not a valid JSON response” error if you try to upload images with unsupported characters in the image name. So, you can rename your image using only English letters, numbers, and supported symbols like hyphens. Then you can upload that renamed image to see if the error has been fixed.
Use Default to GD plugin
Some people were also able to solve The response is not a valid JSON response error by using the Default to GD plugin. This plugin isn’t available on WordPress so you will need to download it from the Default to GD GitHub link.
Click the “Code” button on the page to download the plugin.
Then choose Download ZIP from the drop-down menu.
This will start the installation of the plugin on your computer.
Then navigate to Plugins, then Add New on your WordPress dashboard.
Now, click the Upload Plugin button, and then choose the plugin you just downloaded from the Choose File menu.
Then press the Install Now button.
After you’ve finished installing the plugin, click Activate Plugin.
You may now verify if the JSON response problem occurs while uploading photographs to your WordPress site without having to set anything up.
If the issue persists, you can just deactivate the plugin before deleting it.
Most users find that these techniques for resolving the “The response is not a valid JSON response” error work, but if they don’t, you may have a problem with your WordPress settings or your web server.