A Guide to Using WordPress Maintenance Mode

Updating your WordPress website may keep the hackers at bay, but if you do it indelicately, you might scare your visitors away. That’s why there’s WordPress maintenance mode.

What’s WordPress maintenance mode?

via GIPHY

WordPress maintenance mode is kind of like an “Under Construction” sign for your website. It’s a state you can put your website into if you need to make major changes that could make it difficult or dangerous for your visitors to use your site.

Is there any way to prevent downtime?

Although you can significantly reduce downtime by getting a dedicated server, some downtime is inevitable. For instance, sometimes you’ll need to update a plugin, or revamp your website, or hide your website until you can unveil a product you’ve been working on. But sometimes your website is down because your server simply doesn’t have enough resources to give your website what it needs.

If you’ve been using a VPS, and you find that that’s still not enough to prevent server-related downtime, it might be time to switch to a dedicated server. (Yes, you can choose a dedicated server even if your business isn’t well established.) Dedicated servers are worth checking out for the low downtime. There are also a host of other benefits you get with a dedicated server. Check it out and watch your downtime decrease!

But for those times when downtime is inevitable, there’s maintenance mode.

When to use maintenance mode

1. When you’re redesigning your website

An unexpected redesign could be so jarring to your visitors that they might think your website has been taken over by malicious entities. To prevent any confusion, it’s best to use WordPress maintenance mode if you’re making any major changes to your themes.

2. When you’re launching a new website

via GIPHY

If you’re about to launch a website, and you want to build some hype surrounding your launch. Maintenance mode is a great way to stir interest without spoiling any secrets. If you’re using WordPress maintenance mode in this way, it’s a great idea to add an email form, so you can let your visitors know when your website goes live.

3. When you’re about to unveil a seasonal product

If you’re selling a seasonal product, like yearly planners, or a course that’s available only once per year, WordPress maintenance mode is a smart way to maintain interest in the product and to get visitors to anticipate its return.

4. When you’re fixing a bug that may affect your users’ data

Fixing bugs is tricky business, and you don’t want to complicate matters by having visitors use the site at the same time. Maintenance mode gives you some much-needed breathing room while you’re making your tweaks.

Now that you’ve got some great reasons to use maintenance mode, how do you enable it?

4 ways to access maintenance mode

1. Wait for WordPress’s automatic maintenance mode

WordPress automatically enters maintenance mode whenever you update WordPress core or run updates on your theme or plugins. During the update, your site will display a simple message that says: “Briefly unavailable for scheduled maintenance. Check back in a minute.” Once you finish your update, maintenance mode ends.

2. Do a bit of coding to display your own maintenance message

You can add some personality to your maintenance mode if you use a plugin to add these code snippets to your functions.php file.

// Activate WordPress Maintenance Mode
function wp_maintenance_mode() {
    if (!current_user_can('edit_themes') || !is_user_logged_in()) {
        wp_die('<h1>Cooking up something amazing</h1><br />We’re working on something we know you’ll love, and we can’t WAIT to show it to you. Enter your email address and we’ll let you know as soon as it’s ready!');
    }
}
add_action('get_header', 'wp_maintenance_mode');

Now, instead of displaying a boring, run-of-the-mill maintenance mode message, your site will display a message that looks like this:

Cooking up something amazing

We’re working on something we know you’ll love, and we can’t WAIT to show it to you. Enter your email address and we’ll let you know as soon as it’s ready!

3. Use your .htaccess file

Before you do this, you’ll need to create the maintenance mode page you want your website to display. Give it a name that’s easy to remember, like “maintenance.html”.

Next, go to your root directory and open your .htaccess file. Once you’ve done that, enter this code:

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

This will allow you to replace the normal maintenance message with the maintenance file you’ve created.

IMPORTANT:

Replace the “001\.234…” part of the code with your own IP address, because this is what will let you access the site in maintenance mode.

4. Use a plugin

Plugins like Elementor and SeedProd let you create custom maintenance mode webpages that you can design to reflect your brand.

Custom pages are the best way to infuse your brand’s personality into WordPress maintenance mode. That way, you can turn the usually dreadful maintenance mode into an opportunity to create interest (when you’re launching a new product), to reassure visitors (when you’re tweaking the website), or to collect contact information (when you add an email form).

Wrapping up

Maintenance mode doesn’t have to be a pain for you or for your visitors. Modern iterations of WordPress make it easy for you to enable WordPress maintenance mode, and, with a bit of creativity, you can tweak your maintenance mode message so it puts a smile on your visitors’ faces!