Hi @katering,
There’s a couple of ways of doing this. My preferred approach is to use a function (you’d place this in your functions.php file for your theme) like the below
add_action('init','set_redirect');
function set_redirect(){
global $pagenow;
if( 'wp-login.php' == $pagenow ) {
wp_redirect('YOUR CUSTOM PAGE URL');
exit();
}
}
You’d replace “YOUR CUSTOM PAGE URL” with the actual URL you want to use.
Or, you can use this one
// Hook the appropriate WordPress action
add_action('init', 'prevent_wp_login');
function prevent_wp_login() {
// WP tracks the current page - global the variable to access it
global $pagenow;
// Check if a $_GET['action'] is set, and if so, load it into $action variable
$action = (isset($_GET['action'])) ? $_GET['action'] : '';
// Check if we're on the login page, and ensure the action is not 'logout'
if( $pagenow == 'wp-login.php' && ( ! $action || ( $action && ! in_array($action, array('logout', 'lostpassword', 'rp', 'resetpass', 'register'))))) {
// Load the home page url
$page = get_bloginfo('url');
// Redirect to the home page
wp_redirect($page);
// Stop execution to prevent the page loading for any reason
exit();
}
}
In this case, I am redirecting all requests to the homepage, but this can be any URL of your choosing.
Finally, you can disable wp-login.php if you are using UM to control the login and register process – you can still login and register without it.