How to Put WordPress in Maintenance Mode

Putting your WordPress website in maintenance mode is easy. Just create a file with the following code:

function is_user_logged_in() {
$loggedin = false;
foreach ( (array) $_COOKIE as $cookie => $value ) {
if ( stristr($cookie, ‘wordpress_logged_in_’) )
$loggedin = true;
return $loggedin;
if ( !

stristr($_SERVER[‘REQUEST_URI’], ‘/wp-admin’) && ! stristr($_SERVER[‘REQUEST_URI’], ‘/wp-login.php’) && ! is_user_logged_in() )
$upgrading = time();

This will mean that your website will display the maintenance message but you will still be able login as admin and edit your website.

Save your file and call it .maintenance then upload it to your root website folder e.g. public_html / wwww.  When you want to turn off maintenance mode either rename the file or delete it.

You can edit your maintenance message in the file  wp-/includes/load.php by searching for the wp_maintenance function.

Posted in wordpress

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: