Maintenance WP blog

How to enable and disable the maintenance mode on WordPress ?

Jan 9, 2021

WordPress offers a maintenance mode that, when you make updates, warns the user visiting your website of its temporary interruption. Although this feature is very useful, sometimes your WordPress can get stuck in maintenance mode due to mishandling. In this article, you will find our tips on how to correctly activate WordPress Maintenance Mode and how to unblock it in the event of a malfunction.

Why put your WordPress site in maintenance mode?

The maintenance mode has several advantages when you perform WordPress updates. 

  • It warns the Internet user that the site is under temporary maintenance.
  • It reassures visitors by warning them that the site is not damaged and that it will be accessible again soon. 
  • It gives precise information on the duration of the maintenance 
  • He takes care of the communication of the website 
  • It allows to keep in touch with visitors

Maintenance mode: how does it work?

With WordPress, you can make updates to your website without having to activate the maintenance mode yourself: the platform has introduced in its version 3.0 a feature that automatically sends a message to the user informing him/her of an operation in progress on the page. 

The message sent automatically by the platform is: “Briefly unavailable for scheduled maintenance. Check back in a minute”. The visitor will see this message when you perform an update or a new installation from the dashboard. 

Briefly unavailable for scheduled maintenance - WordPress

As you can see, this automatic maintenance mode delivers a generic sentence that is not very engaging for your visitors. It is even possible that the reader doesn’t even bother to translate it and thinks that your site is no longer operational. 

To make the message more effective and relevant, it is advisable to modify the WordPress maintenance mode yourself. This will allow you to :

  • To add personalized sentences to warn the Internet user
  • Provide more user-friendly notifications
  • To propose alternative links to visit while waiting for the reopening of the site
  • To give a precise deadline for maintenance operations 

Why customize WordPress maintenance mode?

In general, creating a personalized maintenance page has several advantages for the development of your website: 

  • Offer a better user experience to your Internet users
  • Bringing your readers new information 
  • Improve the image of your website
  • Reinforce proximity with visitors 

How do I put my WordPress site in maintenance mode?

Two solutions are available to activate the maintenance mode yourself and customize your page. 

Manual activation without plugin

It is possible to switch to maintenance mode manually. However, this requires some coding knowledge. The operation must also be performed before any new update on WordPress.

  • Find the .maintenance file located in the WordPress root directory.
  • When you have found it, insert the code below in the file : <?php $upgrading = time(); ?>
  • Delete the file when you have completed maintenance.

You can also manually activate the maintenance mode by following these few steps:

  • Use the functions.php file to add functionality 
  • Include in the file a PHP code similar to this one :
<?php
function maintenance_mode() {
  if ( !current_user_can( 'administrator' ) ) {
    wp_die('Maintenance.');
  }
}
add_action('get_header', 'maintenance_mode');
?>
  • Add a custom phrase to describe the maintenance operation (you can also include pictures)

Activation with plugin

The easiest way to activate a customized maintenance world is to install a specific plugin. Two WordPress extensions are particularly easy to use and allow a wide range of customization:

The Maintenance plugin

Maintenance plugin

It is probably the most downloaded maintenance plugin by WordPress users. It’s completely free and gives you the ability to customize the text and page to your liking (color, design, background). Several other features are available with the plugin, such as installing a countdown timer or links, or subscribing to the site’s newsletter.

Coming Soon Page & Maintenance Mode by SeedProd plugin

Coming soon plugin SeedProd

This plugin, launched in 2011, is also very handy to customize a maintenance mode on WordPress. Free or paying (depending on the chosen offer), it has the advantage of working with all WP themes, of being responsive – compatible on all supports (computer, smartphone, tablet) – and of allowing Multi-site. 

Several other maintenance plugins are available on WordPress. Choose the one that best meets your requirements!

How to fix a WordPress site stuck in maintenance mode?

WordPress is frequently stuck in maintenance mode. You can no longer connect to your site, and users will always see a message telling them that something is being done. There are several possible reasons for this: 

  • WordPress accidentally shut down during the maintenance process. 
  • The plugin update has been interrupted while it was loading 
  • A bad update of the plugins has been done

Whatever the problem, if WordPress is stuck in maintenance mode, it means that the temporary maintenance file .maintenance (created in the main folder by the platform at the beginning of the operation) has not been deleted. Don’t panic! This is a relatively common problem that you can easily fix: just manually delete the .maintenance file by following these steps:

  1. Access the Web server with an FTP program
  2. Enter the WordPress root directory
  3. Delete the .maintenance file
  4. Update again if necessary

Also remember to empty the cache from your dashboard toolbar. Your site should then function normally again.

Find all our advice on our blog or contact our experts to help you install or unblock the maintenance mode of your WordPress site!