How to Put WordPress in Maintenance Mode

WordPress powers more than 75 million websites on the internet today, which is more than 30% of the internet websites. Were you amazed by this number? Well, there’s more to come. WordPress dominates the Google SERPs with whopping 2.28 million results.
Although it is quite popular because of its ease of access, WordPress maintenance becomes quite a daunting task as a website grows. When you implement a major update on your WordPress site, you have to put your website in a Maintenance Mode to help your users know that your website will be live again shortly.
But how to put your website in website in maintenance mode? In this article, we’ll discuss only that. But before we dive into that, here’s a brief overview of what WordPress Maintenance Mode is to give you a better understanding of the subject.
Let’s begin.
What Is WordPress Maintenance Mode?
In simpler words, WordPress Maintenance Mode is technically a status that enables you to showcase a notification telling that the website is undergoing maintenance. It even shows a timeframe that shows an estimation of when the website would be live again, along with the alternative links to visit it.
Making it easier, this user-friendly message substitutes your actual website while it undergoes maintenance.
Technically, WordPress creates a .maintenance file containing the maintenance and timeframe notification using a function called wp maintenance when you initiate website maintenance. This file is automatically deleted once you’re done with the maintenance, and the website goes live with the updates.
Now that you know what WordPress maintenance mode is, here’s why you need to activate it.
Why Do You Need To Activate WordPress Maintenance Mode?
Nobody likes to see a website with a plain white page saying “webpage/site not available.” Your WordPress website does something similar when it undergoes maintenance.
If you do not activate the maintenance mode on your website, it showcases a plain splash page with a message, “Briefly unavailable for scheduled maintenance. Check back in a minute.”This may sound quite normal, but it critically damages your reputation in front of your audience and potential clients.
People today are impatient, and as soon as they see this text, they’ll bounce off your website and start looking for better alternatives to meet their needs.
In contrast, if you opt for changing the default maintenance notification message on your WordPress site, you’ll let the users know that there this no fault with the website, and it will go live again with better functionality.
Now you know why it is important to activate maintenance mode on the WordPress site, which brings us down to our final point – How to put WordPress on Maintenance Mode.
Let’s dive into that now.
How To Put WordPress Into Maintenance Mode?
Typically, there are three main methods of putting your WordPress into maintenance mode. Here they are
- Using WP Maintenance Mode Plugin
- Manually Activating Maintenance Mode Using A Custom Function
- Using .htaccess File
Using WP Maintenance Plugin
This is perhaps the most popular way of activating maintenance mode on your WordPress site. It automatically performs the entire process without the need for any changes in the code.
Those who have minimal technical knowledge use this method as a great approach as you do not even need to touch a single line of code. All you have to do is to download the wp maintenance plugin and install it.
Once you’ve activated the plugin, there are some settings that you need to configure. Here’s how.
Go to the Settings and tap on the WP Maintenance Mode. You will see five different tabs, including General, Design, Modules, Manage Bot, and GDPR.
Here’s what you need to do with each tab.
General
This is the first tab that you’ll see in the series. Here’s what you need to do with the General tab.
- The first thing that you’ll see in the General tab is the Status. Change your plugin status to Activated to activate WP Maintenance Plugin.
- Following the status option, the next thing you’ll see is the Bypass for Search Bots Change this option to Yes as it allows the Google bots to access your website even during the maintenance.
- The last important thing on the General tab is Backend Role and Frontend Role. Here you’ll have you determine the user who can access your website’s backend or frontend amid the maintenance period. (Note that if you do not configure these roles, the access would only be allowed to the administrator).
Design
The design tab is where you determine how your splash page would look like. Here you can set the desired text that you want to appear in the maintenance notification. Here’s how it works.
- Go to the Title (HTML tag) option and add the title of your splash page, heading, and the custom message that you want in the notification.
- Now, choose a relevant background for your splash page, which could be solid colors or even images.
Modules
Setting up the timeframe of your maintenance period for the users is critical, and this is what you do in the Modules tab.
- Set up a countdown timer – Starting Time and the Remaining Time.
- Now add the alternative links for redirecting your audience to your social media networks. Once you add links to your social media, the plugin automatically displays a social media button on the splash page.
Please add a subscription option for your audience so that they can be notified once your website goes live again.
Manage Bot
Even when your website is down due to maintenance, it is important to engage with your audience via interactive communication. This is where the Manage bot tab gets useful.
You can leverage this tab to add chatbots to your splash page, which helps you maintain interactive communication with the audience. You can even give an avatar and name to your chatbots, which will make it more engaging.
GDPR
If you choose to provide your audience with a subscription option, this tab is quite useful.
GDPR stands for General Data Protection Regulation. It is important to activate this tab since you’re collecting visitors’ data.
Once you’ve completed the process, tap on Save Settings before you visit your website’s page.
Manually Activating Maintenance Mode Using A Custom Function
Using this method, you can put your site in maintenance mode manually. However, unlike the first method, using a custom functionality is quite technical as it activates WordPress Maintenance Mode without a plugin.
But don’t worry. Below we have mentioned the code lines that you can incorporate at the end of the theme’s functions.php file to activate maintenance mode without a plugin.
// Activate WordPress Maintenance Mode
function wp_maintenance_mode() {
if (!current_user_can(‘edit_themes’) || !is_user_logged_in()) {
wp_die(‘<h1>Under Maintenance</h1><br />Website under planned maintenance. Please check back later.’);
}
}
add_action(‘get_header’, ‘wp_maintenance_mode’);
To customize your maintenance message, you can change the text between quotation marks in the line 4 of code.
Note that it is important to back up your site’s data before you follow this method, as it requires you to make changes in the functions.php file.
Using .htaccess File
The final method for activating maintenance mode is by adding the below-mentioned code into the .htaccess file. You will find this file in your website directory, where you have to rename it to .htaccess_default and create a new file named .htaccess. Once you’ve created the file, add the following code inside it.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ https://example.com/maintenance.html [R=307,L]
Now create another file in the website directory named maintenance.HTML and put your custom maintenance message inside.
Note that it is important to backup your .htaccess file before proceeding with this method, as you’ll make certain changes to it.
One thing to remember here is that by using the .htaccess method, you won’t be able to access your site’s admin panel as all the requests are automatically redirected to the maintenance.html file.
Wrapping It Up
These were the three methods that you can use to put your WordPress site in maintenance mode. Here’s a brief overview of them all.
- The first method would automatically put your website in maintenance-mode for WordPress by using a plugin.
- The second method would require you to add a code snippet to your PHP file.
- The third method would require you to add codes in your .htaccess
Leverage these methods mentioned above to put your WordPress in maintenance mode and help your audience avoid abandoning your website.