WordPress Maintenance Mode: The most complete guide

WordPress Maintenance Mode

Running a website can be hard work, especially when it comes to keeping up with all the maintenance requirements. Whether you’re working on your own site or maintaining someone else’s, there are times when your website will need to go into WordPress maintenance mode. Maintenance mode is a state that allows you to update plugins and themes without affecting the live version of your site.

This article will show you how to put WordPress websites in maintenance mode with and without plugins as well as what to do when sites get stuck in this state.

What Is WordPress Maintenance Mode?

The WordPress maintenance mode is used to show visitors that a website is currently undergoing some changes. You can display a message to your users that lets them know why your site is offline, which provides a much better user experience than having your site’s traffic encounter a broken webpage.

WordPress features a default maintenance mode page that is enabled automatically when your make updates to your them, plugins, or during WordPress core updates. Usually, these kinds of updates are very fast, so the page isn’t shown for long.

You can use the default maintenance mode provided by WordPress, or you can set up a more appealing page and customized message of your own by using some of the techniques inside this article.

By the way, some people also refer to this mode as WordPress Construction Mode.

That’s actually not quite right, but it gives you a hint what you can use this mode for as well.

When Should you Use Maintenance Mode?

It is a good idea to activate maintenance mode any time you wish to make changes or tweaks to your website that could result in pages appearing temporarily broken. Usually, when you are making larger changes over longer periods, it will be appropriate to use maintenance mode, especially if your website gets a lot of traffic.

In general, you will deploy maintenance mode when making significant changes to your website’s layout, theme, or content. You will also want to put your website into maintenance mode for debugging and troubleshooting issues such as hacking.

How to enable WordPress Maintenance Mode without plugins

1. Using a Simple Code Snippet

A quick and effective method of displaying a maintenance page is to insert a short snippet of code into your site’s theme. This method will show a very simple page, but it is perfect for short durations when you don’t need to communicate much information.

Step 1 – Access the WordPress theme editor

Navigate to the menu on the left of your WordPress backend and select Appearance > Theme Editor.

Note: you may need to request admin access if the theme editor option isn’t visible to you.

Step 2 – Open the functions.php file

On the right-hand side of the theme editor, you will find a list of editable files. Select the one labeled “Theme Functions (functions.php). You will now see the code editor area for this file.

Step 3 – Insert the maintenance mode code snippet to the functions.php file

Optional step: Copy all of the current code inside the functions.php code editor and save it. This will make it very simple to reset things back to their original state should you need to.

Scroll to the bottom of the code editor and insert the following custom code snippet:

// Activate WordPress Maintenance Mode

function activate_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’, ‘activate_maintenance_mode’);

The snippet above will display a page titled “Under Maintenance” followed by the text “Website under planned maintenance. Please check back later.”

If you wish to customize this text, simply edit the following line of code with your preferred messages:

'<h1>Under Maintenance</h1><br />Website under planned maintenance. Please check back later.'

Click on the blue “Update File” button when you are happy with your code.

Step 4 – Confirm maintenance mode is working

If you try to view your site when logged in, the maintenance mode page won’t appear. You can either log out of the admin dashboard and then view your site again or open it up inside an incognito/private browser tab to check maintenance mode has been activated.

To deactivate the maintenance page, delete the code you entered, save the file, and recheck your website to confirm it is running normally.

2. Using .htaccess file

To use this method, you will need to access your website’s .htaccess file, which you can find on your site’s server in the root directory. You will find it inside the public_html folder.

WordPress Maintenance Mode htaccess
To activate maintenance mode, find your .htaccess in the root folder of your domain

This method requires you to create an HTML page that will be served to your visitors once you’ve input the correct code into your .htaccess file.

Step 1 – Backup your original .htaccess file

Make a copy of your .htaccess file and save it with a different name so you can recognize it.

Step 2 – Create your maintenance page

You’ll need to know how to code a simple HTML web page, where your visitors will be redirected. Once you have your page code, create a file in your root directory named “maintenance.html” containing your new page.

Step 3 – Add the code to activate maintenance mode

Inside your .htaccess file, enter the following lines of code at the very top:

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_URI} !^/maintenance\.html$

RewriteRule ^(.*)$ https://example.com/maintenance.html [R=307,L]

This code snippet tells your server to redirect visitors to the maintenance.html page you uploaded earlier, which can be customized however you wish.

3. Using a WordPress Maintenance Mode Plugin

1. The coming soon page and maintenance mode Plugin by SeedProd

This plugin is one of the most popular and straightforward to use for WordPress. The plugin allows you to create and display a custom maintenance message page to your visitors.

Put your WordPress site into maintenance mode with SeedProd plugin
Put your WordPress site into maintenance mode and create amazing coming soon pages with this plugin

Step 1 – Install and activate the SeedProd plugin

Search the WordPress plugin library for the plugin titled “Coming Soon Page, Maintenance Mode ; Landing Pages by SeedProd.

Install and activate the plugin.

Step 2 – Set up your maintenance mode page

In the left-hand menu of WordPress, navigate to SeedProd > Pages. Select the button to set up a maintenance mode page.

Here, you can customize your page using the intuitive drag and drop builder inside SeedProd.

Get your page looking exactly how you want it and click “save.”

Step 3 – Enable WordPress Maintenance Mode in SeedProd

Navigate back over to SeedProd > Pages, where you’ll now see some different options below the maintenance mode section.

To enable the mode, simply click the green activation switch, so it displays “active.”

You can now open an incognito/private browser window and check that your site is in maintenance mode.

2. WP Maintenance Mode Plugin

Another widely used plugin for the task is WP Maintenance Mode. The customization options and page builder are simpler than the SeedProd plugin, but this lightweight plugin is quick and easy to work with.

WP Maintenance is a lightweight but powerful free plugin
WP Maintenance is a lightweight but powerful free plugin

Step 1 – Install and activate the WP Maintenance Mode plugin

Search the WordPress plugin library for the plugin titled “WP Maintenance Mode.”

Install and activate the plugin.

Step 2 – Configure your plugin settings

Using the left-hand menu inside WordPress, navigate to Settings > WP Maintenance Mode.

The plugin features five tabs where you can edit various maintenance mode settings to suit your requirements. The very first option under the general tab is “status,” this is where you can enable and disable maintenance mode.

Directly below the status option is another key setting titled “bypass for search bots.”

It is recommended to switch this over to “yes” if you are running an established site since this setting allows search engines to see your website even when in maintenance mode.

You can browse through and change other maintenance page settings as you see fit, depending on what you need for your website.

Step 3 – Create your maintenance page

The second tab inside the plugin is the design area, where you can create your custom design.

You can go through the editor and input your new page’s titles, content, and backgrounds. Click “save” when you are happy to save changes.

Step 4 – Add other features to your page (optional)

The remaining tabs inside the WP Maintenance Mode plugin allow you to configure and add other handy features to your landing page. 

You can add a countdown, email list subscription button, social buttons, and even set up an automated chatbot.

Step 5 – Enable Maintenance Mode

Head to the general settings tab and select the “activated” option below “status.” You can now check your page is being displayed correctly by opening an incognito/private browser and viewing your website.

Preventing your site from getting stuck in WordPress maintenance mode

There are a few reasons why your site could end up being stuck in maintenance mode.

Plugin glitches are one of the reasons that are, unfortunately, difficult to solve for yourself. Quite often, glitched will require patches and updates to the plugins by the developers.

A website can also get stuck as a result of compatibility issues with the plugins. In this case, the first thing to do is check your WordPress current version is fully up to date.

You must also be sure to look at each plugin’s compatibility before you install them. The compatibility information is shown beneath the plugin title in the plugins area.

Don’t update all your plugins at the same time

Finally, making too many plugin updates at once can cause an error that results in your site being stuck on the maintenance page.

To minimize this risk, it is good practice to update plugins gradually as the updates become available instead of doing batch updates.

Making regular backups of your website in between updates will also make it easy to revert your site to its most recent working state very quickly should any errors occur.

Maintenance Mode Troubleshooting

Stucked in maintenance mode? How to take WordPress out of it.

If you have used the methods outlined in this article to put your site into maintenance mode, taking it out should be simple.

All you need to do is reverse the steps taken in this guide and remove any code snippets you entered to bring your website back online.

If you have used the suggested plugins, each of them has a toggle where you can activate and deactivate maintenance mode easily.

If you feel your site should be working but is still stuck in maintenance mode, try looking inside your site’s root directory for a file named “.maintenance.”

Deleting this file should solve the problem.

Photo of author

Written for you by

David Williams

WordPress Fellows

2 thoughts on “WordPress Maintenance Mode: The most complete guide”

  1. Hi David,

    I’m hoping you might be able to help me with a question. A friend’s website is in maintenance mode, but she is still receiving emails that users are registering for her website. Is this possible? How would I be able to help her troubleshoot?

    Thanks so much!!

    Reply
    • Hi Nicky,

      this sounds completely strange. Normally, when a website is in maintenance mode, there is no chance for any registrations. Did she turn on the maintenance mode via code (.maintenance file) or via a plugin?

      Hope I can help you and your friend!

      Reply

Leave a Comment