Created
July 21, 2012 13:25
-
-
Save gyrus/3155823 to your computer and use it in GitHub Desktop.
Force WordPress login
This file contains 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 | |
/** | |
* Force WordPress login | |
*/ | |
add_action( 'init', 'pilau_force_login' ); | |
function pilau_force_login() { | |
if ( ! is_user_logged_in() && $_SERVER["SCRIPT_NAME"] != '/wp-login.php' ) { | |
wp_redirect( wp_login_url() ); | |
exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment