SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30
SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30
BACK TO TOP

How to Fix the WordPress Update or Publishing Failed Error

How to Fix the WordPress Update or Publishing Failed Error

Even though WordPress has long gone from being a blogging platform only, publishing or updating posts is still an important task for WordPress webmasters, editors, or authors, regardless of the website’s niche. Therefore, the inability to update or publish WordPress posts can greatly obstruct their workflow, especially if it happens for no apparent reason.

In this article, we will explain the reasons why such an error has been appearing recently. It is accompanied by error screens stating “Update failed” or “Publishing failed”, which cause a lot of frustration since they tell little about the cause of the error. Nevertheless, this error has a rather straightforward troubleshooting process, which we will outline in this article. Here is what we will be covering:

Qode Themes: Top Picks
Bridge New Banner
Bridge

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme
Stockholm

A Genuinely Multi-Concept Theme

Startit WordPress Theme
Startit

Fresh Startup Business Theme

Why Does the WordPress Update or Publishing Failed Error Happen

As mentioned above, the name of this error comes from the messages which appear when the error occurs. More precisely, while trying to publish a post using the Gutenberg editor, you might see the “Publishing failed” error message, while after editing an already published post, the error message “Update failed” might appear on the screen after clicking the Update button.

Publishing Failed
Updating Failed

And, while there are many possible reasons as to why these two possible variations of the error occur, they are all directly tied to how Gutenberg functions. Specifically, it is because the Gutenberg plugin relies on REST API to publish and update posts. Let us briefly touch on what REST API is.

Simply put, the WordPress REST API (Representational State Transfer Application Programming Interface) is a highly standardized communication protocol between WordPress and other web systems which ensures that they all understand each other properly. Therefore, this greatly broadens the spectrum of web-based applications that WordPress can interact with, transforming it into much more than a simple content management system (CMS).

This functionality was previously part of WordPress.com or was available as a separate plugin, but has been integrated into the WordPress Core with the introduction of Gutenberg as the default WordPress editor in the WordPress 5.0 update.

Therefore, if the connection with the REST API has been lost, blocked, or purposefully disabled, you will not be able to publish and update your WordPress posts using the Gutenberg editor. The reasons for breaking the connection between WordPress and REST API include faulty internet connections, firewall settings, faulty WordPress plugins or their settings, and others.

Having explained why the error happens, let us go into the troubleshooting methods needed to solve it. We have sorted them into several subsections, starting from the ones easiest to implement. Furthermore, we have also included an alternative way of solving the issue, in case you are unsuccessful in resolving the error using our other suggestions. With that said, let us proceed.

Initial Troubleshooting

Before we really get into troubleshooting, we suggest double-checking whether the issue is persistent or if it was only temporary. After verifying that the issue hasn’t been resolved on its own, it is good to test certain specific reasons which could lead to the error. We will cover them in this section.

Checking the Internet Connection

The most obvious reason as to why you might be seeing the Update or Publishing failed error is lack of internet connection, which is needed to connect to the REST API if you are working in a non-local environment.

Make sure that you have a stable internet connection by accessing other websites in new browser tabs. After having made sure that any issue with the internet connection has been rectified, try to publish/update the post once more to test if the error has been resolved.

Checking the Site URL

Another obvious reason why REST API might have issues connecting to your website is when your website URLs aren’t properly updated to reflect their current values. Of course, we are referring to the WordPress Address and Site Address found in Settings > General. It doesn’t hurt to verify whether they are properly set or update them if they aren’t to see if the issue disappears afterward.

To do that, navigate to Settings > General and locate the WordPress Address and Site Address options. These addresses represent the location of your WordPress files and the URL that the visitors have to type into their address field in order to access your website, respectively. Make sure that they are both correct. If they aren’t, edit them so that they show the correct addresses. Click the “Save Changes” button to apply any changes.

General Settings Addresses

After editing the addresses, you will need to relog into the website using your credentials. Then, test the status of the issue by publishing/updating a post.

Saving Permalinks

Sometimes, the issue could be a corrupt .htaccess file. To test quickly if this is the case, you can simply update the permalink structure which will recreate the default .htaccess file.

To do so, navigate to Settings > Permalinks and click the “Save Changes” button at the bottom.

Permalink Settings

Then, review the status of the issue. If it persists, proceed below. Additionally, we need to mention that saving permalinks is also recommended after disabling WordPress plugins. As some plugins add rewrite rules to the .htaccess file, making sure that the file is recreated in its default state will ensure that the troubleshooting is thorough.

Checking the REST API Status

Since we already mentioned that the main reason for this error is a problem in the connectivity with the REST API, it comes as no surprise that one of the first troubleshooting steps is to check whether the REST API has experienced any issues or has been disabled. Even though this may seem difficult to check, there is an easy way of doing so by using the Site Health tool introduced in the WordPress 5.2 update.

To do so, navigate to the Tools > Site Health section and open the Status tab. There, you can see all the suggested improvements for your website. Specifically, if the REST API is experiencing any issues or if it is disabled on your website, you will see a message stating “The REST API encountered an unexpected result”.

REST API Site Health

Clicking on that error message will reveal more information regarding the issue. You should inspect it to figure out how you can solve the issue. In most cases, it could be due to faulty code or third-party service settings, which you can pinpoint and resolve. But, in case you don’t see an error message, proceed below to the remaining troubleshooting steps.

Disabling WordPress Plugins

A very common reason for the Update or Publishing failed error are misconfigurations in the settings of certain plugins. Caching, website optimization, or website security plugins are commonly among the culprits, as some of them offer a way to disable REST API, while others might block the connection using various security restrictions. Whatever the case, the best way of figuring out whether one of your plugins is behind the error is to disable them and inspect the status of the issue. We will explain how you can do it properly below.

First, navigate to Plugins > Installed Plugins and tick the checkbox at the top to select all the plugins. Then, select the Deactivate option from the Bulk Actions dropdown and press the “Apply” button to deactivate all the plugins.

Disabling Plugins Bulk Action

Having deactivated the plugins, try to publish or update a post you previously weren’t able to. If you can publish/update the post at this point, it means that the issue was caused by one of your plugins. To pinpoint which one, try to activate the plugins one at a time and, then, test the status of the issue afterward.

If the issue reappears, the plugin you last activated is the culprit. If that is the case, to solve the issue completely, we advise consulting the plugin authors. On the other hand, if the issue has persisted after deactivating all WordPress plugins you have on the website, then you should proceed to the remaining troubleshooting steps, as the fault does not lie in any of your plugins.

Checking the Firewall Settings

Website firewall services like Cloudflare or Sucuri and certain WordPress firewall plugins can also be the culprit for this error. Specifically, certain strict firewall rules could be blocking legitimate REST API requests, misinterpreting the URLs as a possible DDOS attack on your website. To test this, you can temporarily disable your firewall service or plugin and check the status of the issue. If the issue is resolved, it means some of the rules of your firewall service or plugin are to blame.

This means that you need to inspect all the firewall rules set within the relevant dashboard or plugin options, respectively. To pinpoint the exact rule(s) you need to disable, we advise consulting the firewall service/plugin support. On the other hand, if the issue persists even after disabling the firewall, proceed to the subsequent methods.

Reviewing the Debug Log

Even though WordPress doesn’t keep track of REST API errors, it has a debugging system which logs all WordPress coding-related errors. And, as the issue can be related to a faulty code snippet, it is worth enabling this debugging system to inspect if this is the case on your end.

To do so, connect to your server using your FTP credentials first. Navigate to the root WordPress directory and locate the wp-config.php file within. Right-click the file and click on the “View/Edit” option from the menu that appears.

Debug WP Config View Edit

Open the file using your preferred file editor and locate the comment section that mentions the WordPress debugging mode. After it, add the following two lines of code:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

as shown in the screenshot below.

Debug Codes

In most cases, the first line will already be present, but the value of the WP_DEBUG constant will be set to false. You only need to set it to true and insert the second code line afterward.

The first line of code enables the WordPress error logging on the server, while the second specifies that the errors should be logged at a predefined location – the wp-content/debug.log file. For additional debugging settings, we advise consulting our article on editing the wp-config.php file and possible configurations you can implement.

That done, you should navigate to the wp-content folder and locate the debug.log file. Right-click on it and select the “Download” option to download it to your computer.

Debug Download

Then, open the debug.log using your preferred text editor and investigate the error messages shown, especially their respective file paths. If any point to your theme or some of your plugins, then addressing their respective authors for help is advised. We also advise attaching your debug.log file when asking for help, as it will speed up the resolution process.

And, once you have successfully resolved the issue, you can disable error logging by removing the second code line and resetting the WP_DEBUG constant to false. Conversely, if you weren’t able to solve the issue, consider using some of our other troubleshooting methods below.

Using the Classic Editor

A potential way of solving the Update or Publishing failed error is to revert to the TinyMCE editor instead of Gutenberg. This change can be both temporary, as you keep searching for the resolution of your issue, and permanent, if you are more accustomed to the old editor anyway.You can enable the Classic Editor by installing the Classic Editor plugin.

If you opt for this step, navigate to Plugins > Add New and look for the Classic Editor in the Featured section. You can also use the search feature to help you find it. Having found the plugin, install and activate it.

Install Classic Editor

This will enable the TinyMCE editor which doesn’t rely on the REST API to work properly. Therefore, you will be able to edit or publish your posts.

Classic Editor Backend

As we have mentioned, you can use this as a way of solving the issue, or as a temporary measure while you look for the root of the initial problem.

Asking Your Hosting Provider for Help

Finally, if you weren’t able to solve the issue using the aforementioned steps, you probably need professional help. Consulting with your hosting provider is often a good idea, as the issue could be due to a server settings misconfiguration, which they will be quick to figure out. Furthermore, they can provide you with the error logs to help you pinpoint the exact file and code line causing the error.

Then, if the error is caused by custom code you have added, you will be able to edit or remove it accordingly. And in the case the faulty file is part of a plugin, you can address the plugin authors for help, as previously suggested.

Final Thoughts

The WordPress Update or Publishing failed error can be quite a nuisance to solve for most inexperienced WordPress users as it disallows creating new posts or editing existing ones for no apparent reason. However, troubleshooting it is relatively easy by following the steps we have carefully outlined in this article. These include checking the internet connection, website URLs, and permalinks, checking the status of the REST API and the firewall settings, disabling WordPress plugins, examining the error log, and asking your hosting provider for help.

Additionally, we have suggested you use the Classic Editor as an alternative solution to this issue. Given how straightforward our suggestions are, we are sure you will be able to solve this issue and regain control over your publishing and editing process. However, as the issue is a possible threat for any Gutenberg-using website, we advise bookmarking this article for future use.

Post your comment

Comments0