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 activity 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/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

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 file .maintenance in the folder, if already this file doesn’t exists.

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

$upgrading = time();

WordPress checks for the file .maintenance in the root folder where this website is installed; if exists the file, it dies with 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.

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.

by Code Steps

Leave a Reply