How to Put Your WordPress Website into Maintenance Mode

So what happens to your website if you need to take it down for a while? Do you just let the website sit idle and allow visitors to see 404 messages?

Maybe you try to schedule your downtime for a time of day when traffic is low.

You don’t want your website to appear dead. Luckily, WordPress websites can be put into maintenance mode so that when you take yours offline, your visitors will be notified that you’re working on your website.

Unfortunately, maintenance mode doesn’t always work correctly. That’s why you also need to know what steps to take in the unlikely event your website gets suck in maintenance mode.

Using Automated Maintenance Mode

If you didn’t already know, WordPress actually has an automated maintenance mode the kicks in whenever you run an update on your WordPress core, or whenever you update either your theme or plugins. This version of maintenance mode puts up a splash webpage on your website stating, “Briefly unavailable for scheduled maintenance. Check back in a minute.”

You don’t have to do anything for the automated maintenance mode to kick in. And once your update finishes, you’re automatically taken out of that mode. For a simple update, this is fine. However, if you’re looking to take your website down for an extended period, or if you don’t want to use the automated maintenance mode, there are other options.

Option 1: The Quick and Dirty — Activating Maintenance Mode Via Code

If you don’t mind coding, you can opt to hardcode your website into maintenance mode. Add the following simple code into your functions.php file, and it substitutes for the automated maintenance mode.

// 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 />We’re working to remove some gremlins from the works. Come back later!’);
add_action(‘get_header’, ‘wp_maintenance_mode’);

Note that you can put whatever you like in the H1 and text section. This code puts your website into maintenance mode and creates a very basic splash webpage for your visitors.

Option 2: Redirecting Your Website to a Maintenance Webpage

Rather than setting up a straight maintenance mode, you can just redirect all traffic to a maintenance webpage. Start by creating and uploading a maintenance.html file to your WordPress directory.

Next, you’ll need to modify the .htaccess file on your server. Verify that you have permission to do this before attempting to set this up. Inside the file, you need to add the following code:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^192\.168\.000\.000
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ [R=307,L]

You’ll notice that you’re not actually putting your website into maintenance mode; instead, you’re sending all traffic to a maintenance webpage.

Option 3: Installing a Maintenance Mode Plugin

If you want to avoid all the hassles of coding your maintenance mode, you have the option of installing a maintenance mode plugin. Just head to the plugins section of your WordPress admin and search for “Maintenance Mode.” Alternatively, if you already know which plugin you want for maintenance mode, you can search for that directly.

A popular maintenance mode plugin is SeedProd’s “Coming Soon Page & Maintenance Mode” plugin. Nifty and Minimal have similar plugins. You can also go with either WP Maintenance Mode by Designmodo, or the Under Construction plugin by WebFactory Ltd.

Once your chosen plugin is installed, you can go to the settings section of your WordPress admin and enable your maintenance mode in a few seconds. Some plugins give you multiple themes to choose from for maintenance mode.

This is the best option for beginners and those who don’t want to take the time to hardcode their maintenance mode.

What’s the Point of Using Maintenance Mode?

There are many updates and functions you can perform in the background without having to take your website offline. These updates are fast, and the automated maintenance mode is good enough for that rare moment when someone happens to visit your website in the four seconds it takes to update your plugin.

However, there are times when your website needs to come down for an extended term:

  • Maybe you’re installing a new theme, and you want to test how it will behave.
  • Perhaps you’re adding more functionality to your website, like a mailing list, advanced e-commerce capabilities, or other features that require extensive testing.
  • Or worse, maybe your website got hacked, and you need to take it offline while you clean things up.

You can also opt to rename it to achieve the same effect.

If you put your website into maintenance mode a different way, getting out of that mode is as simple as undoing your prior action:

  • If you hardcoded your maintenance mode and find that your website is stuck, simply go back and delete the code.
  • If you used a plugin for maintenance mode, just disable the plugin to get out of maintenance mode.

In some instances, you may need to clear your cache in order to resolve the issue entirely. If you take one of the steps listed above and still find that your website in maintenance mode, clearing your cache will often resolve the issue.

Keep Your Customer in the Loop With Maintenance Mode

Back in the day, if a website went offline, you simply came across 404 messages, and customers had to guess whether this was a temporary outage, or whether you decided to give up on your website. With WordPress, your customers can be kept in the loop through maintenance mode.

Note that maintenance mode will work only if your web servers are online and your account is active. If you didn’t pay your bill or the server is down, then your visitors will see messages associated with those problems. Unfortunately, there isn’t much you can do other than get a provider that provides 99.99% uptime or better. If you’re looking to switch to a host offering 99.99% or better uptime, click here to learn about the best website hosting for WordPress.

For the times where you’re forced to take down your website, putting it into maintenance mode is your best play, as it lets your customers know that the outage is temporary. This will make it more likely that they’ll return later. Otherwise, if you fail to keep your customers in the loop, they’ll draw their own conclusions as to the health of your website, and often won’t bother returning.

Leave a Reply

Your email address will not be published. Required fields are marked *