Skip to content

Instantly share code, notes, and snippets.

@mijustin

mijustin/functions.php Secret

Last active Oct 26, 2015
Embed
What would you like to do?
// If user not logged in, redirect to login page
if (
!in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))
&& !is_admin()
&& !is_user_logged_in()
) {
header('Vary: Cookie');
header("Cache-Control: no-cache, max-age=0, must-revalidate");
wp_redirect('http://your-url.com/wp-admin', 302);
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment