How to manually enable and customize maintenance mode in WordPress

Maintenance mode temporarily suspends access to your site and displays a ‘Briefly unavailable for scheduled maintenance. Check back in a minute.’ message to visitors. Maintenance mode is automatically enabled during WordPress updates and disabled when the updates are complete.

However, you may want to manually enable maintenance mode when you’re making updates or changes and don’t want visitors to see your site before it’s ready. This article describes how to manually enable maintenance mode and customize the default maintenance mode message.

Manually enabling maintenance mode

Log in to your HostPapa Dashboard and click My cPanel. In the Files section, click File Manager.

In the root folder of your WordPress installation, click New File. Name the file .maintenance, making sure to include the dot (.) at the beginning. Click Create New File.

Next, right-click the .maintenance file and select EditIf you can’t see the .maintenance file, click Settings in the upper right corner and ensure that Show hidden files (dotfiles) is selected.

The file opens in the File Manager editor. Add the following lines to the file:

<?php
 $upgrading = time();
?>

Note that your site will be in maintenance mode as soon as you save the file. Click Save Changes. The site now displays the default maintenance mode message.

Disabling manual maintenance mode

When you’re finished updating your site and want to disable manual maintenance mode, you can simply delete the .maintenance file. However, if you think you’ll put your site in maintenance mode again, you may want to rename the file instead of deleting it. This way, the next time you want to enable maintenance mode, you can rename it to .maintenance again, instead of creating a new file.

Right-click the .maintenance file and select Rename.

Name the file any descriptive name you want and click Rename File. In this example, we’re calling it .maintenance-disabled.

Your site is now displayed normally to visitors.

Customizing the maintenance mode message

You can customize the message that is displayed to site visitors when the site is automatically or manually put in maintenance mode.

Log in to your HostPapa Dashboard and click My cPanel. In the Files section, click File Manager.

In the root folder of your WordPress installation, open the wp-content subfolder. Click New File. Name the file maintenance.php and click Create New File.

Right-click the maintenance.php file and click Edit.

Add the HTML or PHP code that you want to use to display the maintenance mode message and click Save Changes. In this example, we’re creating a simple message with text and an image.

<html>
<head><title>Offline for maintenance</title></head>
 <body>
 <h2 style="text-align: center;">Sorry, we're currently offline for scheduled maintenance. 
We'll be back soon!</h2>
 <p style="text-align: center;"><img src="https://example.com/wp/wp-content/uploads/2018/01/clouds.jpg" width="600" height="400" /></p> 
 </body>
</html>

The next time the site is in maintenance mode, maintenance.php is displayed instead of the default message.

More information

For information about working with files in the cPanel File Manager, see How to navigate in cPanel’s File Manager.

If you have any questions or need help, you can always contact HostPapa Support by opening a support ticket. Details about how to open a support ticket are here.

Was this article helpful?

[was-this-helpful]

Related Articles

Leave A Comment?