How To Customize Your maintenance File

Wouldn't it be great if you could create a custom message in your maintenance file for whenever your website is undergoing an upgrade?

Wouldn’t it be great if you could create a custom message in your maintenance file for whenever your website is undergoing an upgrade or touch-up without the need of extra plugins? It might come in handy.

WARNING: This is process requires some advanced knowledge of WordPress and Hosting environments.

Okay, so hear me out…it’s not that needed, but it can make things look neat. You are basically allowing your visitors to see a message that could make them feel at ease instead of the generic message:

A message that brings tears to a developer’s eyes.

When you’re finished updating your site and want to disable manual maintenance mode, you can delete the .maintenance file (If WordPress hasn’t done that already). However, if you think you might put your site in maintenance mode in the future, you may want to rename and use the file instead of deleting it.

For example, you can rename it to .maintenance-disabled. This way you, for next time, when you want to enable maintenance mode, you can rename it to .maintenance instead of creating a new file.

Here are the steps to do that:Right-click on the .maintenance file and choose ‘Rename’.

Rename Maintenance File

Name the file any descriptive name you want and click Rename File. In this example, you can call it as .maintenance-disabled .

Rename Maintenance File

This will allow your site to be shown to your visitors again.

But what about the personal message when we want to do maintenance on our site? Here are the steps:

  1. Log in to your hosting Dashboard.
  2. Click on your cPanel or Plesk or whatever you are using — I’m using cPanel as an example here.
  3. In the Files section, click File Manager.
cPanel File Manager Maintenance File

4. In the root folder of your WordPress installation, open the wp-content subfolder. 

5. Click New File. 

6. Name the file maintenance.php and click Create New File.

Rename Maintenance Message

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

Edit Maintenance file message

8. Add the HTML or PHP code you want to use to display the maintenance mode message and click Save Changes. For this example, you can create a simple message with text and an image by using the following code:

<html>
<head><title>Offline for maintenance</title></head>
 <body>
 <h2 style="text-align: center;">Sorry, we are currently offline for scheduled maintenance. 
We will be back soon!</h2>
 <p style="text-align: center;"><img src="https://example.com/wp/wp-content/uploads/2021/01/picture.jpg" width="1000" height="800" /></p> 
 </body>
</html>

Make sure to change the ‘img src’ link to a picture link from your WordPress website and you should be all set. If you have the knowledge of PHP and HTML, you can add and customize this message to your liking.

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

Conclusion:

  1. Don’t delete the .maintenance file from your WordPress root directory.
  2. Rename the .maintenance file to something else so that it is disabled.
  3. Create a maintenance.php file and add it to your server.
  4. Activate the .maintenance file and the php file will show the custom message.

PLEASE NOTE:

If your .maintenance file is deleted, just add a new one and make sure that the ‘hidden files’ are shown on the server. Then inside the .maintenance file, just add this code:

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

This is a manual method of maintenance control for your WordPress site. However, if this helped you, let me know in the comments below.

Stay awesome!

Join to get updates

Similar Posts

API Link chain

What Is An API

Have you ever wondered what API really means and what it’s supposed to do? Find out in this post.

Read More »
No more posts to show