Functions dosyasına ekleyip bir dener misiniz?

// Redirect users who arent logged in...
function login_redirect() {  
  // Current Page  
  global $pagenow;  
 // Check to see if user in not logged in and not on the login page
   if(!is_user_logged_in() && $pagenow != 'wp-login.php')        
  // If user is, Redirect to Login form.        
 auth_redirect(); }
// add the block of code above to the WordPress template
add_action( 'wp', 'login_redirect' ); if ( is_user_logged_in() ) {
  // your code for logged in user
} else {
  // your code for logged out user
}