0

How to redirect the user from this page domain.com/wp-login.php/action=register to another page?

2
  • What do you want to do once they redirect? If you want them to register but just have more fields, there are plugins that extend default registration so they have to fill out more fields, as well as plugins that create a custom branded registration page. If you don't want people to register at all, you can disable new user registration in Settings. If you want people to log in with an external service like LDAP/CAS/Google login, there are authentication plugins that will auto-redirect as well.
    – WebElaine
    Jun 18, 2018 at 15:35
  • I have installed another plugin and created a form for registration that has more fields. I just want them to be redirected to this form. Jun 18, 2018 at 15:49

1 Answer 1

0

Since wp-login.php control both login and registration, it is better to redirect the visitor to a login page from wp-login.php.

You can use this code for redirecting your registration page -

add_action('init','custom_registration_page');

function custom_registration_page() {
 $new_registration_page_url = home_url( '/register/' );
 global $pagenow;
 if( $pagenow == "wp-login.php?action=register" && $_SERVER['REQUEST_METHOD'] == 'GET') {
 wp_redirect($new_registration_page_url);
    exit;
 }
}

This code will redirect user registration to yourdomain.com/register/. You can point to your desired URL on the 3rd line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.