How To Add WordPress Maintenance Mode With Custom Page Without Plugin

WordPress is a powerful CMS(Content Management System) for creating powerful sites with ease. WordPress comes with thousands of plugins for almost every need, it might be for seo or for generating sitemaps and even for switching site to maintainance mode without knowlwdge of any programming .

When a new version is out in wordpress, you will be shown update option in your wordpress dashboard. Once installation of latest version of wordpress is completed then you will be shown WordPress Default Maintainence Page.

WordPress displays this maintenance mode page with the help of .maintenance file which is generated when wordpress is updated.Incase if updatation of wordpress fails to server or network error, then the .mantainance file isnt deleted from the server causing maintainence mode.
Since WordPress 3.0 version of WordPress it started to check for 10 minutes from the starting of the updation. If the time is less that 10 minutes for the starting of the updating .maintenance mode will go live and WordPress maintenance mode gets activated showing a message to the WordPress users
WordPress Customised Maintenance Mode Page
If the time exceeds the 10 mins duration then the .maintenance file automatically dies showing the visitors actual website content. How ever WordPress has included some steps to manually customize WordPress maintenance mode splash page. After WordPress 3.0 in addition to .maintenance it also gave support to custom page called maintenance.php .
You can create a .maintenance file in your wordpress folder and customise it as you like to display message of your choice.
Here is php code of WordPress .maintainance file :
* Dies with a maintenance message when conditions are met.
* Checks for a file in the WordPress root directory named “.maintenance”.
* This file will contain the variable $upgrading, set to the time the file
* was created. If the file was created less than 10 minutes ago, WordPress
* enters maintenance mode and displays a message.
* The default message can be replaced by using a drop-in (maintenance.php in
* the wp-content directory).
* @access private
* @since 3.0.0
function wp_maintenance() {
if ( !file_exists( ABSPATH . ‘.maintenance’ ) || defined( ‘WP_INSTALLING’ ) )
return;global $upgrading;include( ABSPATH . ‘.maintenance’ );
// If the $upgrading timestamp is older than 10 minutes, don’t die.
if ( ( time() – $upgrading ) >= 600 )
return;if ( file_exists( WP_CONTENT_DIR . ‘/maintenance.php’ ) ) {
require_once( WP_CONTENT_DIR . ‘/maintenance.php’ );
We can override and customize that page by simply adding an extra file called maintenance.php in wp-content.
Now you can add your html/php code in maintenance.php file which will replace the default .maintenance file.
You Can also disble WordPress maintenance Mode by replacing 600 with 0 in the above code in loop.php file in wp-includes folder.
// If the $upgrading timestamp is older than 10 minutes, don’t die.
if ( ( time() – $upgrading ) >= 0 )
Here 600 represents Number of seconds in 10 Minutes, changing 600 to 0 disables WordPress Maintenance Mode which is enabled by default.



0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments