How to Customize Your WordPress Maintenance Mode Screen
WordPress maintenance mode screen is a fantastic little feature introduced in version 3.0 and incorporated into the core.
Table of Contents
- You will learn:
- WordPress Maintenance Mode
- Your WordPress Site is Stuck in Maintenance Mode
- Don’t refresh or navigate away from the screen during an update
- How to Repair a WordPress Site That Is Stuck in Maintenance Mode
- Extending Your Maintenance Mode Screen
- WordPress Maintenance Mode: How to Enable and Disable It
- When Should You Use WordPress Maintenance Mode?
- In conclusion
You will learn:
- How to Customize Your WordPress Maintenance Mode Screen
- Using Code to Manually Extend WordPress Maintenance Mode
- Using a WordPress Plugin for Maintenance Mode
- How to Redirect from Maintenance Mode Screen in WordPress
- How to Enable and Disable WordPress Maintenance Mode
WordPress Maintenance Mode
WordPress maintenance mode is a fantastic little feature introduced in version 3.0 and incorporated into the core. When you update a plugin, theme, or WordPress installation, the following message is displayed to your visitors until the update processes are finished.
Some backend activities are temporarily halted during the upgrade and installation procedure (usually only for a few seconds depending upon the number and size of updates). WordPress calls the wp_maintenance() function, which generates a temporary .maintenance file on your site that contains the alert seen above. When the changes are finished, the file is automatically deleted, and your site returns to normal.
Your WordPress Site is Stuck in Maintenance Mode
A typical problem that WordPress users have is that their site becomes stuck in maintenance mode. This can be quite worrisome because it can also impact the administrator and the backend. Suddenly, you are unable to log in to your WordPress site, and your website is virtually unavailable, except for maybe a brief notice displayed to visitors.
When a conflict occurs, the .maintenance file may believe there are still pending operations and or updates that need to be completed, resulting in the user being trapped in maintenance mode. As a result, the file persists and never deletes itself.
Don’t refresh or navigate away from the screen during an update
When the updates screen is refreshed or left during an update, this is one of the most typical causes of a site becoming stuck in maintenance mode. The simplest approach to avoid this is to resist the urge to do anything while the update is being performed.
What is the source of the conflict? In our experience, this occurs when a user manually hits “update now” on a lot of different plugins at a quick rate. WordPress staggers update by default, but if there is even a millisecond delay in the connection, this might cause a sudden conflict, resulting in the stuck maintenance mode.
Another thing you can do to avoid this is to keep your plugins up to date when they are patched. Don’t wait six months and then try to update everything at once.
If you don’t have time to update your plugins regularly, or if you’re afraid you’ll forget, you may install a plugin or change your WordPress settings to do so.
How to Repair a WordPress Site That Is Stuck in Maintenance Mode
Fortunately, if your WordPress site is now in maintenance mode, it is extremely simple to exit and return your site to normal. Simply remove the .maintenance file that was generated.
The first step is to connect to your website via FTP. Then, go to the root of your WordPress site and/or the public HTML folder. This is the same location where your wp-config.php file is typically located. The .maintenance file can then be deleted.
After you’ve erased it, you may reload your browser and your website should be back to normal. It’s also a good idea to clean the cache on your WordPress site.
Extending Your Maintenance Mode Screen
Several methods extend your WordPress maintenance mode, such as manually activating it and/or personalizing the screen to match your branding. The more traffic your site receives, the more essential the maintenance mode messaging and style become, as more people will be exposed to it.
Aside from performing updates, you would want a better maintenance mode page if you manually transfer changes to production.
Because the default maintenance screen is not configurable (it is also dynamically produced), you may wish to customize it to match your website’s logo and design. Here’s a helpful hint for creating a custom page.
Simply create a file called maintenance.php and place it in your /wp-content/ folder. You may then customize it using CSS or even build an entirely new page.
When you upgrade WordPress core, themes, or plugins, the new file with your changes will be used instead. You don’t need to do anything else because the check for this file is already specified in the load.php file in /wp-includes/.
If you’re not comfortable writing code or want something more, you can take your WordPress maintenance mode to the next level by employing various free and paid plugins.
- https://wordpress.org/plugins/coming-soon/
- https://wordpress.org/plugins/wp-maintenance-mode/
- https://wordpress.org/plugins/cmp-coming-soon-maintenance/
- https://wordpress.org/plugins/slim-maintenance-mode/
- https://wordpress.org/plugins/wp-maintenance/
- https://wordpress.org/plugins/minimal-coming-soon-maintenance-mode/
WordPress Maintenance Mode: How to Enable and Disable It
When working on your site but not necessarily performing theme and plugin updates, you may wish to manually enable maintenance mode in WordPress. In this case, WordPress will not automatically activate maintenance mode, therefore you must do it manually. There are two approaches: coding and using a plugin.
You may manually enable WordPress maintenance mode using code by adding the following to your functions.php file. Or, even better, create your own plugin:
function wp_maintenance_mode(){
if(!current_user_can('edit_themes') || !is_user_logged_in()){
wp_die('<h1 style="color:red">Website under Maintenance</h1><br />
We are performing scheduled maintenance!');
}
}
add_action('get_header', 'wp_maintenance_mode');
This will result in a message being displayed to users who are not signed in.
The plugins listed above can also be used to enable maintenance mode.
When Should You Use WordPress Maintenance Mode?
These are the moments when you’re most likely to need it:
- When you are updating plugins, themes, or WordPress itself.
- When you’re updating your theme or plugins.
- When you’re working on your website’s coding
- When you’re making changes to stuff that you don’t want others to view.
In conclusion
As you can see, the WordPress core maintenance mode is excellent. It can, however, be readily expanded and altered to meet your brand.
You may also wish to personalize the text so that visitors and clients understand why your website is unavailable.