The following code will set up the necessary redirection. I use it on most of my sites. Just put in in your (child) theme’s functions.php
file or add it to an mu-plugin
:
function possibly_redirect() {
global $pagenow;
if ( 'wp-login.php' == $pagenow ) {
if ( isset( $_POST['wp-submit'] ) || // in case of LOGIN
( isset( $_GET['action']) && $_GET['action']=='logout' ) || // in case of LOGOUT
( isset( $_GET['checkemail']) && $_GET['checkemail']=='confirm' ) || // in case of LOST PASSWORD
( isset( $_GET['checkemail']) && $_GET['checkemail']=='registered' ) ) return; // in case of REGISTER
else wp_redirect( home_url( '/login/' ) );
exit;
}
}
add_action( 'init','possibly_redirect' );