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!

Read more here: How do you redirect the wordpress login and register page to a custom login and register page?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: