Last active
September 15, 2016 09:26
-
-
Save lunaroja/8b6428bd78eaab85aba33d0699a77850 to your computer and use it in GitHub Desktop.
require login to see wordpress site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function login_redirect() { | |
global $pagenow; | |
if(!is_user_logged_in() && $pagenow != 'wp-login.php') { | |
auth_redirect(); | |
} else { | |
return site_url(); | |
} | |
} | |
add_action( 'wp', 'login_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment