During your management of your WordPress blog, you will often want to make it inaccessible to the public. This is often called " go into maintenance mode", especially if the reason for doing so is to perform maintenance on your WordPress blog.

Whether you're upgrading from a simple plugin or making large-scale changes to the site, the maintenance mode is a handy tool you need to have. But when should it be used? Are there times when it is inappropriate to use it? And how can you implement it as effectively as possible?

These are questions that I will try to answer today. So pull up a chair and sit back.

Why maintenance mode?

There are several situations where the maintenance mode is very convenient.

Updates of the site

The first situation is when you are making updates to the website, which may involve updating themes and plugins, or installing and setting up a new theme. Usually a new theme means you need to at least set some default options in order to see how it performs. Maybe it involves customizing the widget areas. Or maybe you want to customize colors and fonts or build a special layout.

Whatever the case, you definitely don't want your visitors to be confused when they go through different posts and pages and see a different site every time. In such situations, turning on maintenance mode lets you know that you are working on your site and that they can come back later once you have everything set up the way you want.

Building a website

The second situation is when you are building your site on a live domain and you don't want your visitors to see what you are about to launch. But maybe you want a way to grow your email list or the number of subscribers you'll keep informed when everything is ready.

In this case, it will not make sense to present an evolving site to visitors. The elegant solution is to activate the maintenance mode which allows your visitors to subscribe to your newsletter and follow you on social media.

There are several ways to put your site in maintenance mode. In what follows, we will explore the advantages and disadvantages of some tools.

WordPress Maintenance Mode

1 Method: Integrated Maintenance Mode

The first way to put your WordPress site in maintenance mode is without actually having to do anything. WordPress has its own built-in method for creating and displaying a maintenance message and it happens every time you run an update, whether it's one for a plugin, theme, or for the WordPress update. WordPress automatically creates a ". Maintenance" file at the root of your site's installation that displays a message to anyone who accesses your website.

The message is simple and looks like this:

« Briefly unavailable for scheduled maintenance " or " Not available for scheduled maintenance"

Once the updates are complete, your site is automatically made available and your visitors can freely continue browsing your site as if nothing had happened.

This method works great when all you are doing is updating your themes and plugins. However, if the updates are going to take a while and / or if you really want to work on your site and make changes, there are other ways to display a message in maintenance mode.

2 Method: WordPress Manual Maintenance

If you are comfortable with writing code and don't want to install yet another plugin then the best way to do this is to add a few lines of code to your functions.php file.

Your functions.php file can be found in " Appearance> Editor". By default the style.css file will be opened, but on the right side you can see other files that make up your theme. Click on functions.php and at the very bottom of this file paste the following code then save:

// Activate WordPress Maintenance Mode function wp_maintenance_mode () {if (! Current_user_can ('edit_themes') ||! Is_user_logged_in ()) {wp_die (' Website under Maintenance We are performing scheduled maintenance. We will be back online shortly! '); }} add_action ('get_header', 'wp_maintenance_mode');

The advantage of this approach is that anyone who is not logged into your website will see a maintenance page like below:

WordPress Maintenance Manual

3 Method: Maintenance Mode with Plugins

Finally, the third way to activate maintenance mode is through plugins, which is especially handy if you don't feel comfortable with codes or want more customization than the other two offer. methods.

1 - WP Maintenance Mode

wp-maintenance-fashion WordPress plugin

Download

WP Maintenance Mode is a free plugin that allows you to add a maintenance page to your site to let visitors know that your blog is under maintenance. There is also the possibility of adding a “ Coming soon For new sites.

There are various options in the plugin configurations so that you can change the plugin state, redirect bots, and set user level restrictions. With minimal configuration you can get a nice page " splash " in a few minutes.

With more than 400.000 active installations and an 4 / 5 rating on WordPress.org, this plugin is very popular and worth checking out.

2- Simple Maintenance Plugin

Simple_Maintenance WordPress plugin

Download

Simple Maintenance Plugin does not require any configuration. All you need to do is activate the plugin and your site will be in maintenance mode. It is simple and offers a responsive design.

3- Slim Maintenance Mode

Slim_Maintenance WordPress plugin

Download

Slim Maintenance Mode is another lightweight plugin that puts your site in maintenance mode just by activating the plugin. The plugin works with any theme and you can see an alert message on the dashboard when the plugin is active. It sends an HTTP 503 Service Unavailable status code response, which is especially useful when it comes to search engines because it won't hurt your rankings. To deactivate the maintenance mode you simply have to deactivate the plugin.

That's it for this tutorial. Feel free to share it with your friends on your favorite social networks.