Most websites require regular updates and up-keep to stay in good shape and keep performing optimally. Sites developed using WordPress are no different. In this tutorial, you will learn what maintenance mode is in WordPress and how you can get your site out of maintenance mode. We will also learn how to put a site in maintenance mode or display a custom page for websites in maintenance mode.
Why WordPress Might Get Stuck in Maintenance Mode
WordPress automatically enables maintenance mode on a website if it is updating or making changes to any core files. The same thing happens when you are updating themes and plugins installed on the website. The maintenance mode on the website is usually only enabled temporarily. Once the update process completes, the website goes back its regular functioning self.
There are a few situations where your website might stay stuck in maintenance mode.
Interrupted Update Process
The primary reason for a website to get stuck in maintenance mode is that something might have interrupted its update process from completing successfully. In this case, the activated maintenance mode on the website will not be deactivated keeping your site stuck.
Compatibility Issues
Sometimes, the plugins and themes you are installing or updating might not be compatible either with each other or with new WordPress versions. In either case, this will cause a conflict during the update process, and you will see your website stuck in maintenance mode.
Lack of Server Resources
A WordPress website might also stay stuck in maintenance mode if it doesn’t have enough server resources. Lack of memory or processing power can interrupt the update process and keep the website in maintenance mode.
Outdated PHP Version
The same thing can happen if an old or incompatible PHP version causes conflicts during the update process.
Incorrect File Permissions
Incorrect file permissions can also lock down a website in maintenance mode if the interrupt the update process.
Why WordPress Puts Websites in Maintenance Mode
WordPress putting your website in maintenance mode is beneficial for both you and your visitors.
Users are likely to comes across broken pages or functionality on your website if they visit it while an update is in progress. This might leave them confused. Showing a simple message that informs them about the ongoing maintenance is a great way to ease their concerns.
Another benefit of putting a website in maintenance mode is that it will prevent users from making further requests to access the site. Let’s say a webpage doesn’t load properly. Users are more likely to hit the refresh button in the hope that it loads properly the next time. On the other hand, a maintenance message will let them know that the website is currently undergoing maintenance, and they should visit it after some time.
Updates usually take some time to complete successfully. If users can access your website during that time, they might take some action that causes errors either during the update or after the update.
A WordPress website might be more vulnerable to attacks from malicious users while it is undergoing an update. Therefore, it makes sense to block access to the website during this period by enabling maintenance mode.
How Does WordPress Enable Maintenance Mode?
Before we learn how to get our website out of maintenance mode or manually put it into maintenance mode, we need to know how it activates maintenance mode in the first place.
WordPress creates a file called .maintenance in the root directory of the website whenever it has to go into maintenance mode. This file contains information relevant to the maintenance mode like when it was activated and so on.
WordPress will check for the .maintenance file in the root directory whenever someone visits your website. If this file is present, any website visitors will see a message similar to “Briefly unavailable for scheduled maintenance. Check back in a minute.”.
How to Prevent WordPress From Getting Stuck in Maintenance Mode
WordPress undergoing maintenance mode is a useful feature that improves user experience while maintaining security. Once the update process complete successfully, WordPress deletes the .maintenance file automatically and takes itself out of maintenance mode.
However, WordPress can sometimes get stuck in maintenance mode due to reasons we mentioned earlier. There are a few things that you can do to prevent this from happening:
One of the most common reasons that can get your website stuck in maintenance mode is incompatibility between plugins. You should make sure that any plugins that you install are compatible with your version of WordPress. This is actually very easy to do as plugins provide this information in their description as shown in the image below.
In case of the Gutenberg plugin, we need a PHP version above 5.6 and WordPress version above 6.1. The plugin is also compatible up to version 6.2.
Another common reason that can cause a website to stay stuck in maintenance mode is navigating away while the update is in progress. You are supposed to wait until the update is complete before refreshing the page. Abruptly refreshing or navigating to a different page prevents WordPress from deleting the .maintenance file and it stays stuck in maintenance mode.
WordPress Tutorials and Courses
Final Thoughts
In this tutorial, we learned quite a few things about the maintenance mode in WordPress. We now know why WordPress enables maintenance mode on a website and the likely causes that can result in your website being stuck in maintenance mode.
Finally, we learned how to get our website out of maintenance mode in case it gets stuck there.