vegangirlthatcodes
2/27/2018 - 12:35 PM

Only show maintenance mode if user is not logged in. Add a maintenance.php file to wp-content folder to customize your maintenance page.

Only show maintenance mode if user is not logged in. Add a maintenance.php file to wp-content folder to customize your maintenance page.

<?php
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();
?>