CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

How to put WordPress based blogs / websites into maintenance mode?

Maintenance mode is useful to set your website in offline mode when you are doing any maintenance activities on your website. Usually most of the software provides this as a simple feature; we can just enable this feature just by selecting a check-box. By default WordPress is not providing a simple way to enable or disable this feature.

This article is explaining the steps to put WordPress based websites into maintenance mode.

This article is applies to:

  • WordPress Version 3.8.x

Step 1. Log-in into your website’s control panel as an administrator.

Step 2. Go to the folder where you installed your WordPress based website.

Step 3. Create a .maintenance file in the folder where WordPress is installed (assuming the file is not exist already).

Step 4. Put the following code in .maintenance file and save the file.

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

How this code works? WordPress checks for the file .maintenance in the root folder where this website is installed. If it finds the file, it displays a maintenance message when $upgrading variable’s value (timestamp) is less than 10 minutes. If $upgrading variable’s value is set to current time using time() function, it always satisfies the condition that $upgrading variable’s value is < 10 minutes.

Step 5. Refresh your website and you can find the following message.

Briefly unavailable for scheduled maintenance. Check back in a minute.

Step 6. If you want to provide your own message, then go to wp-includes folder and look for load.php file.

Step 7. Open load.php file and search for the above message in the file. It will be in the following function;

function wp_maintenance()

Step 8. Once you modify the file; save the file and refresh your website. Now you will see your own message on the screen.

This is the way you can enable maintenance mode for WordPress based websites. If you want to put your website into on-line mode, revert back the above changes you made in respective files.

Simply removing the .maintenance file will put WordPress into on-line mode.

How to put WordPress based blogs / websites into maintenance mode?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top