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, if you’re making updates and changes and want to prevent visitors from seeing your site before it’s ready, you may want to enable maintenance mode in WordPress. In this article, we’ll show you how to manually enable a maintenance file in WordPress and customize the default maintenance mode message.
Manually enabling maintenance mode
You can create a maintenance file in WordPress to manually enable maintenance mode by following these steps:
- Log in to your HostPapa Dashboard.
- Click My cPanel.
- In the Files section, click File Manager.
4. In the root folder of your WordPress installation, click New File.
5. Name the file .maintenance, making sure to include the dot (.) at the beginning.
6. Click Create New File.
7. Right-click the .maintenance file and select Edit.
8. If you can’t see the .maintenance file, click Settings in the upper right corner and ensure that Show hidden files (dotfiles) is selected.
9. The file opens in the File Manager editor. Add the following lines to the file:
<?php $upgrading = time(); ?>
10. 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 delete the .maintenance file. However, if you think you might put your site in maintenance mode in the future, 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 instead of creating a new file.
- Right-click the .maintenance file and select Rename.
2. 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
Follow these steps to customize the message site visitors see when the site is in maintenance mode.
- Log in to your HostPapa Dashboard.
- Click My cPanel.
- In the Files section, click File Manager.
4. In the root folder of your WordPress installation, open the app subfolder.
5. Click New File.
6. Name the file maintenance.php and click Create New File.
7. Right-click the maintenance.php file and click Edit.
8. Add the HTML or PHP code 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>Sorry, we're currently offline for scheduled maintenance. We'll be back soon!</h2> <p><img src="https://example.com/wp/app/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 our Knowledge Base article: How to navigate in cPanel’s File Manager.
If you need help with your HostPapa account, please open a support ticket from your dashboard.