For some reason it seems that WP3.0 is bugged with everything relate to maintenance-mode.
The 2 maintenance-mode plugins (maintenance-mode & wp-maintenance-mode) cause the following problems:
The same thing happend to me when I tried to write it by myself using this tutorial.
This line worked perfect and showed the built-in maintenance screen, but when I tried to add the condition for is_user_logged_in()
, the mode stops working, letting you see the cliend & back end, when u r logged in or logged out.
What can I do? Thanks for all the answerers.
The is_user_logged_in()
function the tutorial provides is pretty terrible, and it's why you're getting false positives for being 'logged in'.
Instead, load the pluggable file that contains the default WordPress is_user_logged_in()
function;
require_once (ABSPATH . WPINC . '/pluggable.php');
if ( ! stristr($_SERVER['REQUEST_URI'], '/wp-admin') && ! stristr($_SERVER['REQUEST_URI'], '/wp-login.php') && ! is_user_logged_in() )
$upgrading = time();
else
$upgrading = 0;