With the WordPress maintenance mode, your actual website is temporarily switched to another page.
Read the following lines to find out how to activate maintenance mode and deactivate it manually in case of problems.
The WordPress maintenance mode is a helpful feature when you are in the process of building or remodeling your website. So not every visitor can see your virtual construction site, and you decide when it will be visible online. Likewise, WordPress maintenance mode is automatically interposed when you update WordPress.
By activating the WordPress maintenance mode, your visitors will know that your website is not constantly but only temporarily offline. It is also possible to place other information (such as contact information or other advantageous features) on the temporarily displayed page. You can either use a WordPress maintenance service or a WordPress maintenance mode plugin. Instead of peering curiously over your shoulder, visitors will then see “Caution, construction site” or an information page that you have set up.
You can activate WordPress maintenance mode manually or with a plugin. Depending on the processing and level of knowledge, either one or the other variant makes more sense. If you only want to make small (cosmetic) changes, then using a plugin is more like shooting at sparrows with a cannon. More complex processing or an extensive web project makes the use of an additional plugin quite useful. This allows you to attract visitors to your site, e.g., B. inform when the page is available again.
Note: WordPress’s maintenance mode automatically switches during a theme or plugin update. Depending on your needs, you can activate or deactivate it without having to install any additional extensions.
Activate WordPress maintenance mode without plugin
To manually switch to WordPress maintenance mode, you can create a file called .maintenance in the root directory (note the dot in front of Maintenance). Use a text editor to insert the following short PHP code into this file:
CODE:<?php $upgrading = time(); ?>
The file is automatically created and usually automatically removed if you use a maintenance mode plugin. You can leave the included timestamp blank.
IMPORTANT:
When you have finished your work and want the page to be visible again, you must not forget to delete the file after successful Maintenance.
WordPress Maintenance Mode through the functions.php
Another way to start maintenance mode manually is to use the functions.php file. The functions.php is a so-called template file. Such files are used to add functionality and features to WordPress. For maintenance tasks, you can add a short PHP code to functions.php that activates maintenance mode. A possible entry in the functions.php looks, e.g., B. as follows:
CODE: <?php function maintenance_mode() { if ( !current_user_can( 'administrator' ) ) { wp_die('Maintenance.'); } } add_action('get_header', 'maintenace_mode'); ?>
You can, of course, also enter text or images displayed on the page during Maintenance. Appropriate PHP knowledge is required for this. A simple entry in functions.php can look like this:
CODE: function kb_maintenance mode() { if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) { wp_die('<h1>We are currently updating this website</h1><p>We are currently working on our website to adapt it for improve it. Please check back soon.</p> ', 'site under maintenance'); } } add_action('get_header', 'kb_maintenance mode');
These codes bring up the default WordPress maintenance mode page, which is very
simplistic.
WordPress Maintenance Mode – The simpler alternative
WordPress maintenance mode plugin
If you feel insecure using PHP and the root directory, it seems too risky (which it isn’t) or inconvenient; you can also enable WordPress maintenance mode with a plugin. Depending on the requirements, there are different plugins for this.
Maintenance Mode Plugin #1: Maintenance
After you have installed the Maintenance plugin, you will find a dedicated navigation item in the admin menu called Maintenance. There you can make the necessary plugin settings.
Although these are very extensive, they are very clearly laid out. Here you can, e.g., B., upload a background graphic or your logo or use a graphic from the media library.
Caution: This will overwrite the default settings. You can also determine the text that is displayed on the maintenance page yourself.
You can also turn the visitor login page on or off, block specific pages, and further customize the maintenance page using CSS, as needed.
A slider lets you toggle maintenance mode on and off in the plugin settings.
Maintenance Mode Plugin #2: WP Maintenance Mode
The plugin’s settings can be found in the admin menu in the “Settings” section. The clear administration area of the plugin is divided into 3 sections: “General,” “Design,” and “Modules.”
- Under “General,” you can activate maintenance mode, make settings for the admin, and block selected content.
- Under “Design,” you can set the text display yourself and the background of a static page.
On the other hand, there is no field in which you can insert your CSS code. Also, you cannot lock or unlock content as quickly as in the Maintenance plugin. For this, you will find a countdown in WP Maintenance Mode in case you need something
like that (e.g., for a relaunch).
Maintenance Mode Plugin #3: Coming Soon Page & Maintenance Mode
After installing Coming Soon Page & Maintenance Mode, you can find the plugin’s settings in the admin menu under “Settings.”
The settings are divided into four sections: “Content,” “Design,” “Advanced,” and “Live Preview.” After activating the maintenance mode, you can decide whether you want to show a maintenance page or a coming soon page, which is particularly suitable for revisions, and when you know when the work will be completed.
- Under “Content,” you can add the text for the maintenance page and a graphic (your logo?) and even make SEO settings for the maintenance page.
- Under “Design,” you can choose a background graphic or color, define text and link colors, and insert your CSS code.
- Under “Advanced,” some settings can be customized using scripts (CSS, JavaScript). Unless you have advanced knowledge in these areas, you should instead leave this function unused.
- Finally, under “Live Preview,” you can display a live preview of the maintenance page.
WordPress Maintenance Mode – Tips & troubleshooting
What to look out for in maintenance mode
If you run a non-commercial site, you can choose what information you want to display as a maintenance message. However, if the site is commercial, you must note that the maintenance mode does not release you from the legal obligation to provide information (imprint). In other words: the page displayed during the maintenance work must contain a pattern for commercial websites.
The imprint contains mandatory information such as the e-mail address or the postal address of the website operator. Since offering a contact option is advisable anyway, this is not only a legal requirement but also a good service from the point of view. This enables your visitors to contact you even during the maintenance period.
In case of problems: deactivate maintenance mode manually.
When the maintenance mode is activated, WordPress creates the temporary, manually created file .maintenance (note the dot in front of the file name) in the main folder. It is usually deleted after the end of maintenance mode. However, the file may not be deleted if an update is not carried out correctly or not entirely. This then causes maintenance mode not to exit.
This problem can be fixed quite easily: delete the .maintenance file manually
By using an FTP program
To delete the .maintenance manually, proceed as follows:
- Access your web server using an FTP program (e.g., FileZilla).
- Navigate to the root of your WordPress installation.
- Here you should find the .maintenance.
- Delete these.
- If necessary, update again.
Conclusion
If you want to hide your maintenance work from the eyes of visitors, you don’t need to build a wall, but you will find numerous good free plugins for the maintenance mode.