Created
February 4, 2012 13:08
-
-
Save daltonrooney/1737771 to your computer and use it in GitHub Desktop.
WordPress function - redirect all non-logged-in users to the login page.
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 | |
/* Redirect all non-logged-in users to the login page (private site). Add to functions.php. */ | |
function admin_redirect() { | |
if ( !is_user_logged_in()) { | |
wp_redirect( home_url('/wp-admin/') ); | |
exit; | |
} | |
} | |
add_action('get_header', 'admin_redirect'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment