Solved: Please check @Brasofilo solution on Redirecting Wordpress's Login/Register page to a custom login/registration page
I am using the WPforms plugin to create my own login and register forms in combination with the login-logout plugin. The login-logout plugin links to the default wordpress login and register pages, but I would like to use the custom WPforms pages that I created.
So far, I tried to follow this thread.
The first solution:
add_action('init','possibly_redirect');
function possibly_redirect(){
global $pagenow;
if( 'wp-login.php' == $pagenow ) {
wp_redirect('http://google.com/');
exit();
}
}
This allows me to redirect to my custom login page, but also redirects the 'register' button to my custom login page.
The second solution in that thread:
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() ); // or wp_redirect(home_url('/login'));
exit();
}
}
add_action('init','possibly_redirect');
This solution gives me a message that link doesn't exist.
Please let me know if any other information would be helpful. Thanks!