WordPress Tutorial

How to Put WordPress in Maintenance Mode

WordPress Maintenance Mode article featured image

If you want to perform a big update, you may need to put your WordPress site in maintenance mode. This state means your website is unavailable for some time.

What is WordPress maintenance mode and how to put your site in maintenance? We will help you understand everything you need to know about WordPress maintenance mode in this tutorial. We will also show how to edit the default WordPress maintenance message to make it more appealing.

What is WordPress maintenance mode?

Let’s start with the basics. WordPress maintenance mode is a status you apply to inform visitors about maintenance on your website. It’s a page or a message that substitutes your actual website. On this page, you can add the estimation when the website is going to be live again.

During this process, WordPress will use function wp_maintenance and create a .maintenance file that contains the maintenance message. After the maintenance process is completed, WordPress will delete the file. Your website should work as normal.

When should I set my website to maintenance mode?

First, you don’t need to enable maintenance mode every time you make a change. Like updating content, fixing minor bugs, or changing some color schemes.

But as your website grows bigger, the changes might be bigger and take longer. Changing your theme, implementing new features, or setting up new services on your website may require downtime. This will prevent visitors from accessing your website.

What are the side effects of website maintenance to your visitors?

By default, WordPress creates a splash page that informs your visitors about the maintenance. However, it is just a plain white page with a text “Briefly unavailable for scheduled maintenance. Check back in a minute.”

This plain splash page definitely creates an unpleasant user experience for your visitors. Your business might give a poor impression to your potential clients. Visitors don’t really care what happens behind the curtain. Thus it’s a good idea to change the default WordPress maintenance mode page. Read on, if you want to learn how to do this properly.

Why do you need to activate WordPress maintenance mode?

In this section, we will show how to create a more compelling WordPress maintenance page. For example, you will learn how to show a time estimate of how long your website will be unreachable, add alternative links, even a chatbot that can serve your visitors. Lastly, you will learn how to redirect your visitors to a different website during maintenance.

How to Put WordPress in Maintenance Mode? Use These 3 Methods

Method 1 – Using WordPress Plugin

The method is dedicated for those who want to activate WordPress maintenance mode without touching a single line of code.

All you need to do is download and install the WP maintenance mode plugin. After the activation, you need to configure the plugin’s settings. To do this you go to your right tab and choose, Settings -> WP Maintenance Mode.

In the settings page, you will see 5 tabs: General, Design, Modules, Manage Bot and GDPR.

WP Maintenance Mode Settings

We will discuss each tab and some important options in each tab below.

General

The first tab is the General tab. In the top of the General tab, you will find Status. In order to activate this plugin and set your website to WordPress maintenance mode, you have to change it to Activated. Under the Status options, you will find Bypass for Search Bots feature. If you set this option into Yes, search engines will be able to access your website during maintenance.

Next, there are a Backend Role and Frontend Role options, here you can choose which user roles can access your backend while it is under maintenance mode. If you don’t set this, only the Administrator will be allowed.

Design

The Design tab is where you create an attractive splash page. To start creating your splash page, you can directly go to the Title (HTML tag) option. In this part, add the title of your splash page as well as Heading and the Text.

Once you are done with the message, you can change the background of your maintenance page. For example, you can change its color or go even further and use an image as a background.

Modules

In this tab, you can set the countdown timer. Set the starting time and the remaining time. In addition, you can ask your visitors to subscribe to get a notification once your website is live again.

The next option in the Modules tab is the place where you can configure your social networks. All you need to do is put your social media account link. The plugin will automatically show the social media button icon on the page.

Manage Bot

The next useful tab is the Manage Bot tab. This tab allows you to add a chatbot to your splash page. Thus, you can maintain interactive communication with your visitors despite being in maintenance mode. You can even name the bot and give it an avatar.

GDPR

If you ask your visitors to subscribe in your splash page, you need set up your GDPR tab. GDPR stands for General Data Protection Regulation. Since you are collecting your visitor data, you need to activate it.

Once preparations are complete, press Save settings button and visit your website.

WordPress Maintenance Mode Enabled

Method 2 – Using a custom function

This method requires to edit functions.php file. We strongly recommend making backup of your WordPress site before proceeding.

The second method may be a little bit technical. But, don’t worry. We will make it simple.

Remember the default maintenance page that is automatically set by WordPress when our website is under maintenance? You can put your WordPress in maintenance mode manually and customize the page without any additional plugins.

All you need to do is to add these lines of code at the end of your theme’s functions.php file.:

// 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');

Change the text between quotes in line 4 to customise your maintenance message.

Method 3 – Using .htaccess file

This method requires making changes to .htaccess file. We recommend to backup your .htaccess file before proceeding.

Also note that by using this method, you will not be able to access your WordPress admin dashboard as all requests will be redirected to maintenance.html file.

You can find .htaccess in your website’s directory. Simply rename your currect .htaccess file to .htaccess_default and create new file named .htaccess and add the following code snippet:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ https://example.com/maintenance.html [R=307,L]

Now create a maintenance.html with your maintenance message file in your website’s directory.

Closing

There are quite a few ways to put WordPress in maintenance mode. The first method is by using the WP maintenance mode plugin. This WordPress plugin will help you create a beautiful splash page. This method is recommended for those who are not familiar with coding. The second method requires adding a php code snippet to your functions.php file. The last method that you can try adds code to your .htaccess file.

About the author

Dina F.

Dina is a digital content writer at Hostinger. Having years of experience in digital marketing and website creation, she seeks to help Hostinger users learn more about internet marketing and WordPress. When she is away from her keyboard, she likes to have short city tours and explore new local food places.

Add Comment

Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Exclusive Content

Join thousands of webmasters who get our free newsletter with tips on how to drive more traffic and revenue to their websites!

Please wait...

Thank you for sign up!

More in WordPress Tutorial
15+ Best Free and Paid WordPress Portfolio Themes (2019)

Close