Updating WordPress and it’s plugins and themes is usually straightforward. You navigate to the “Dashboard | Updates” and update the components. If an error happens while updating WordPress Core or plugins/themes, WordPress can usually handle this and roll back, but sometimes things go wrong.
Failed updates break the site
If the update fails, your site might end up being broken. In this case, you will probably get the following message:
Briefly unavailable for scheduled maintenance. Check back in a minute.
When WordPress performs updates for core (or multiple plugins), it will enable a maintenance mode and inserts a lock into the database.
Repairing the site
The two locks will be automatically removed after 15 minutes. As it will not only break the backend, but also the frontend of your site, you probably don’t want to wait 15 minutes.
Deactivating the maintenance mode
The first thing you can do is searching for the file
.maintenance file in the root folder of your WordPress installation. This file contains a single line of PHP code with the UNIX timestamp on when the installation process of the update started:
<?php $upgrading = 1648994440; ?>
If you delete this file, the message will disappear and WordPress will show the frontend and backend of your site again.
Resuming the previous update
Even after removing the
.maintenance file, you can’t continue updating WordPress core. If you try to update it right away, you will probably see the following message:
Another update is currently in progress.
This is caused by the
core_updater.lock option WordPress sets when starting the core update process:
$ wp option get core_updater.lock
As you can see, it has a slightly earlier time (it’s set before the ZIP is being downloaded and extracted). When you are sure that the previous core update process really stopped, you can remove this option either using a database management tool or with the WP-CLI:
$ wp option delete core_updater.lock
Success: Deleted 'core_updater.lock' option.
Now you should be able to restart the update process, this time hopefully without an error causing your site to break again.
While WordPress updates usually don’t cause issues and run quite smoothly, an error can always happen. In these cases, you should know how to quickly get your site working again and not having it broken for 15 minutes.