Skip to content

Instantly share code, notes, and snippets.

@cjwd-snippets
Created September 20, 2016 17:04
Show Gist options
  • Select an option

  • Save cjwd-snippets/4cda826d2177d7caccfb84497ef269d6 to your computer and use it in GitHub Desktop.

Select an option

Save cjwd-snippets/4cda826d2177d7caccfb84497ef269d6 to your computer and use it in GitHub Desktop.
Redirects wp-login.php to custom login page
add_action('init', 'studious_redirect_to_custom_login');
function studious_redirect_to_custom_login() {
$login_page = home_url('/login/');
$page = basename($_SERVER['REQUEST_URI']);
if( $page == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
wp_redirect($login_page);
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment