Advertisement
utema

Untitled

Aug 13th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. // checks if a user is logged in, if not redirect them to the login page
  2. function auth_redirect_login() {
  3. $user = wp_get_current_user();
  4. if ( $user->id == 0 ) {
  5. nocache_headers();
  6. wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
  7. exit();
  8. }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement