The Complete Guide: WordPress Maintenance Mode

5 September 2016 by in category WordPress Maintenance tagged as , , with 0 and 0
Home > Blog > WordPress Maintenance > The Complete Guide: WordPress Maintenance Mode

WordPress Maintenance Mode is a very useful feature, used when performing various maintenance tasks on your website. In this article, we will explain in detail when and how to use maintenance mode, how to customise it, and what to do if your site gets stuck in maintenance mode during an update.

WordPress Maintenance Mode

What is WordPress Maintenance Mode?

WordPress Maintenance Mode is a native WordPress functionality, whose purpose is to inform your visitors that the website is unavailable at the moment, but will be back and functional very soon.

Maintenance mode can occur automatically, or you can choose to induce it manually with a few lines of code, or using a plugin.

Automatic WordPress maintenance mode occurs whenever you are performing an update. WordPress generates a small file called .maintenance in the root folder of your website’s installation. If anyone visits your website while the maintenance is happening, their browser will pick up the generated WordPress maintenance mode file and display a message defined in that file.

The standard WordPress maintenance message is short and clear:

Briefly unavailable for scheduled maintenance.

Check back in a minute.

This message serves the purpose, but it is not very user-friendly. Also, it doesn’t fit every situation. Sometimes maintenance lasts a little longer, and you might like to display a different message to your visitors.

Fortunately, you can easily customize the message and the whole maintenance page, to ensure it’s user-friendly and fits with your corporate branding. We’ll dive into details, and the best practices on how to customize your maintenance mode page, later in the article.

When you should use WordPress Maintenance Mode

Using WordPress Maintenance ModeThe rule is very simple – You should use maintenance mode whenever your website is undergoing changes that you would rather keep away from the public.

Maintenance mode’s purpose is to serve a static page with the maintenance message for all visitors and users, except administrators. Therefore, this functionality becomes very handy in situations when:

  • you are performing any updates – including the core, plugin, theme and regular updates.
  • there are significant design changes – for example, when you want to test different layouts or new color schemes.
  • you’d like to test a new theme or a new functionality – such as introducing new widgets, event triggered custom messages or testing and adjusting a new theme.
  • something breaks and you need to fix it.

Though your visitors will see only the static maintenance page, you’ll be able to see your website maintenance progress, as long as you are logged in as an administrator.

Maintenance Mode or a Coming Soon Page?

Maintenance Mode Coming Soon PageMost WordPress users don’t realize there is a difference between WordPress Maintenance Mode and a Coming Soon Page. Using them incorrectly can hurt your SEO, and even get your website deindexed from Google searches.

When your website is in maintenance mode, it serves a 503 status to search engine bots. A 503 status is a signal that your website is currently down for maintenance and they should return to crawl the website later. If your website has a 503 status for a longer period of time, the search engine bots can interpret it as a sign your server is permanently unavailable, and therefore deindex your site.

Using #WordPress maintenance mode for a longer period of time can hurt your #SEO. Click To Tweet

For this important reason, maintenance mode’s primary purpose is in short-term usage. When your website is going through updates or changes, and will be alive again soon, it is desirable to use maintenance mode.

However, there are times when you know your website will be unavailable for days, or even weeks. For example, if you are working on a live site. In this case, instead of maintenance mode, you should use the so-called Coming Soon page.

Unlike Maintenance mode, a Coming Soon page doesn’t serve a 503 status and permits search engine bots to crawl your website.

There are several benefits of using a Coming Soon page:

  • Your website has high chances of being indexed by search engines, even before the launch.
  • You can collect emails from visitors interested in your products or services.
  • On your Coming Soon page, you can serve important information for everyone who comes by.

How to put your website in maintenance mode

There are several different ways to put your website in maintenance mode. All of these methods work well, but you should choose the one that fits your needs best, and with which you feel most comfortable.

Built-in WordPress Maintenance Mode

As we explained earlier, events such as a plugin or theme updates will trigger the built-in maintenance mode automatically. The default maintenance mode message will display to your visitors. Once the update completes, WordPress disables maintenance mode and everything goes back to normal.

WordPress Maintenance Mode with a plugin

The easiest way to put your website in maintenance mode is using a WordPress maintenance plugin. Here at purpleplanet, we are using a premium ManageWP plugin. This plugin offers much more than a custom maintenance mode. It is a complete WordPress maintenance solution, with automated workflow, which can save a lot of time, especially if you are maintaining multiple websites.

WordPress maintenance mode - ManageWP pluginWith the ManageWP plugin we cover all WordPress maintenance tasks:

  • perform updates
  • cloud backups
  • monitor site performance
  • track website uptime
  • perform security checks
  • edit and remotely control maintenance mode
  • manage comments and revisions

We even track our SEO rating for particular keywords and check Google Analytics data directly on the ManageWP dashboard.

Besides the ManageWP plugin, there are numerous other plugins available, ranging from simple and completely free to premium plugins, all with a lot of different features. Take a look at our review of the best free and paid maintenance mode plugins.

Manually – WordPress Maintenance Mode without a plugin

If you don’t want to install another plugin, there are ways to put your website in maintenance manually:

  • Using the .htaccess file

This method is only an option if you are using an Apache server.

Maintenance mode via .htaccess is a 2-step method. The first step is to create a maintenance.html file. Use this file to display all information you find necessary, and style it to match the rest of your website. When you are satisfied with your work, place the file in your site’s root folder.

The second step is to add a few lines of code to the .htaccess file: WordPress Maintenance Mode Without Plugin

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

This code will redirect everyone, except you, to the maintenance.html file. You only need to replace the numbers 123.456.789.101 with your IP address.

Another manual method is:

  • Placing a simple snippet in functions.php file
Always #backup your website before performing any changes. Click To Tweet

Place the following code at the bottom of 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 style="color:red">Briefly unavailable for scheduled maintenance.</h1><br />Check back in a minute.');
}
}
add_action('get_header', 'wp_maintenance_mode');

When you are done with changes, you can delete the snippet or simply comment out the call-up function, like this:

// add_action('get_header', 'wp_maintenance_mode');

With this method, the maintenance message will be displayed to everyone, except administrators of the website.

Though this method is simple, we have to emphasize that working with functions.php file can be sensitive. If you accidentally delete a part of the code, your website will probably stop working.

For this reason, always backup your website and download the working functions.php file before doing any changes. In case something goes wrong, you can quickly rewrite the broken functions.php file with the previously downloaded working version, via FTP.

Custom WordPress maintenance page

A built-in WordPress Maintenance Mode page serves the fundamental purpose, however, it is good practice to create a custom maintenance mode page that will better serve your needs and reflect your brand accurately.

The problem is that the .maintenance file is generated dynamically and is not customizable. However, there is a workaround for this – you can create a maintenance.php file, customize it with CSS, and put it inside your wp-content folder. The next time your WordPress website enters maintenance mode, it will use the data in this file to display your custom maintenance page.

If you are using one of the WordPress Maintenance Mode plugins, you will be able to easily customize the look and feel of your maintenance page in the plugin settings.

How to design a user-friendly and effective maintenance page

When designing your custom maintenance page, bear in mind what you want to achieve:

  • Make people feel comfortable, and that they are in the right place.
  • Let them know maintenance is in progress, and your website will be available shortly.
  • Give them an opportunity to contact you via email or even a phone. If you are running a web store, you don’t want to miss new orders!
  • Use the maintenance mode page as a lead gen tool.
The basic rule for a good #maintenance mode page is - Keep it simple! Click To Tweet

While having “keep it simple” in mind, the following are some of the best practices for achieving your goals:

  • Include your logo or even the same header you are using on the website.
  • Stay true to your brand – Use the same fonts and color scheme, along with the tone that fits your brand.
  • Display contact e-mail address/phone or both.
  • Give a time frame for people to know when to return, or place an email sign-up form with a smart call-to-action.

How to test your custom made maintenance mode page

After your hard work on customizing the page, you will probably wish to see your maintenance mode in action. You can do it by opening an incognito window in your browser or opening another browser where you are not logged in.

What to do when your WordPress website gets stuck in maintenance mode

WordPress Stuck Maintenance ModeSometimes things can go wrong, and your website might get stuck in maintenance mode. It often happens if WordPress gets interrupted while performing an update, or if the process fails for another reason.

If your website doesn’t leave maintenance mode naturally, you can force it manually. Don’t worry, it is not complicated at all. You just need to delete the .maintenance file from your root folder:

  • Using an FTP connection, via FireFTP extension or a program such as Filezilla.
  • Another simple way to remove the file is using the file manager in cPanel, Plesk or another control panel your hosting offers.

Bear in mind, the .maintenance file is hidden, so if you don’t see it in your root folder right away, you will have to unhide the hidden files first.

Your website can get stuck in maintenance mode even if you are using a plugin. It often happens if you are using a caching plugin as well, or your hosting has a caching layer. In this case, clearing the cache will likely solve the problem.

We hope you found this guide useful in helping you better understand and work with WordPress Maintenance Mode. If you’d like to learn how to run your WordPress website more efficiently, and how to perform basic maintenance, we recommend the following article: Everything you need to know about WordPress website maintenance basics

Did you enjoy this article?

Don't miss out on our new content. Sign Up!

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Copyright © purpleplanet - Software Solutions