Skip to content

Instantly share code, notes, and snippets.

@ptasker
Created May 6, 2013 17:35
Show Gist options
  • Select an option

  • Save ptasker/5526656 to your computer and use it in GitHub Desktop.

Select an option

Save ptasker/5526656 to your computer and use it in GitHub Desktop.
WordPress Maintenance Mode
<?php
//http://sivel.net/2009/10/wordpress-maintenance-mode-without-a-plugin-part-3/
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();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment