Try this instead:
// Custom Login URL
function my_login_page( $login_url, $redirect ) {
return site_url( '/new-login' );
}
add_filter( 'login_url', 'my_login_page', 10, 2 );
The function site_url() outputs http://sub.domain.com then when you pass '/new-login' . $redirect to the function you’re telling it to append /new-loginhttp://sub.domain.com/home/ to the end of the site URL.
https://codex.ww.wp.xz.cn/Function_Reference/site_url
Thanks Kevin,
The redirect now works perfectly. I’m sending visitors to a frontend login form, but when I input the credentials it stays on the login page instead of redirecting them to the homepage. I’m using the following to redirect on sucessful login:
function my_forcelogin_redirect() {
return site_url( '/home/' );
}
add_filter('v_forcelogin_redirect', 'my_forcelogin_redirect', 10, 1);
Is this an issue you’re familiar with?
Thanks again for your help, I really appreciate it.
Graeme
when I input the credentials it stays on the login page instead of redirecting them to the homepage.
Are you successfully logging-in and able to view other pages of the site without being redirected to login? Or are you redirected to login if you try to view any page after submitting your credentials? – I’m trying to determine if this is happening because the site is not recognizing you as logged-in or not.
What does the browser’s address bar list as the redirect URL? e.g. /wp-login.php?redirect_to=
Lastly, maybe try this code instead?
function my_forcelogin_redirect() {
return home_url();
}
add_filter('v_forcelogin_redirect', 'my_forcelogin_redirect', 10, 1);