When updates are made in WordPress, it briefly puts your site in scheduled maintenance mode. Although this is normally temporary, there is a possibility that your website will get stuck in maintenance mode. I discovered this issue recently, so I figured I would share my experience and how I fixed the error.
Why does WordPress get stuck in maintenance mode?
WordPress has a built-in maintenance mode as part of its automatic update system. It is activated whenever you update the WordPress core, themes or plugins from your WordPress dashboard. When you run an update, you will see some messages on the update screen. In most cases, your site goes into maintenance mode, performs updates, and then returns to normal. Sometimes something goes wrong and your site gets stuck in maintenance mode.
You may have seen that when you update WordPress, themes, or plugins and when trying to access your website, the message is displayed:
“Not available for scheduled maintenance. Check the site again in a few minutes.”
This is because WordPress has enabled maintenance mode and displays this screen to avoid performing front-end actions while the site is being updated.
However, it sometimes happens that even when the update is completed, you continue to see this screen, it is in these cases that WordPress has not properly disabled the maintenance of the site.
Some reasons for this may include:
- You inadvertently close your browser tab or window in the middle of the update process.
- You are trying to update a massive amount of plugins at a time.
- There is some sort of compatibility issue (with a theme or plugins) that causes maintenance mode to crash.
If your site is blocked, you will see the following message when you visit your site on the front-end:
Briefly unavailable for scheduled maintenance. Come back in a minute.
Stay tuned, we’re going to explain how to remove the WordPress scheduled maintenance notice.
How to fix WordPress stuck in maintenance mode error
While the updates are running on your site, it creates a file named .maintenance in the root directory of your WordPress site (the same where your wp-config.php file is located).
In order to fix the WordPress stuck in maintenance mode error, you will need to manually delete the .maintenance file. You can do this via FTP or via the file manager in cPanel.
To resolve the error, simply navigate to your website root folder, locate the .maintenance file, and delete it. Now your site should be working again. You’ll also want to clear your WordPress website’s cache.
Read: wordpress vs sucuri
Once you have fixed the error stuck in maintenance mode,
you can try to run the updates again.
Prevention of error stuck in maintenance mode This error is very easy to fix, but it’s best to try and prevent it from happening in the first place.
There are several things you can do to reduce the risk of it crashing again, including:
Make sure plugins and themes are compatible Before running updates,
make sure that any plugins or themes you are using are compatible with your version of WordPress.
You can check this from your dashboard by going to Plugins > Installed Plugins. Then with any plugin that needs to be updated, just click on the Details link below.
Warning message due to updates
In general, it could be that some update processes have not been carried out and that is why the maintenance mode was still enabled. However,
you should not think that the site has been damaged and that you have to recover a backup as the solution is very simple.
Deleting the .maintenance file
When WordPress shows the maintenance screen it is because it creates a file called .maintenance in the root of your site,
within that file, there is a code that indicates the maximum time that the site will be in maintenance.
To remove the maintenance mode simply access by FTP or use the File Manager of your Cpanel to see the files of your website.
When accessing, it locates within the general structure of files and folders in WordPress the .maintenance file.
From this screen, you have the option to delete this file and with that, you would eliminate the WordPress maintenance mode.
What if the file does not appear?
If you cannot find that file, it may be hidden, check the configuration option:
You will see a popup appear where you will see an option to show hidden files, check this option and save the changes:
After this, you should see the .maintenance file and you can delete it.
You should also check the front-end of your site again and refresh the browser, you should see your site correctly again.
Conclusion
As we have seen, when you get the message that the site is temporarily under maintenance or scheduled maintenance, it is because updates are being made.
If the message does not disappear after completing the updates completely, you can disable WordPress maintenance mode manually.
While using self-hosted WordPress, you are bound to encounter an error every now and then. During the recent update of my site, it got stuck in scheduled maintenance mode and I wasn’t sure how to fix it.
I quickly found a solution online and thought it made sense to write a tutorial about it. Hope this helps you get your site up and running again, you have encountered the stuck in scheduled maintenance mode error.
If there is anything that I missed, or if you have a question, please leave it below in the comments.