tomve

WP redirect non-logged users to login page

Jan 30th, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1.     /**
  2.      * Function redirects non-logged users to login page
  3.      *
  4.      * @return  false
  5.      */
  6.     function login_redirect()
  7.     {
  8.         global $pagenow;
  9.  
  10.         if( !is_user_logged_in() && ($pagenow != 'wp-login.php') ) auth_redirect();
  11.  
  12.         return false;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment