WordPress – How to redirect wp-login register link to page

The following WordPress filter will redirect the wp-login.php register page to /register

For example

FROM

http://example.com/wp-login.php?action=register

TO

http://example.com/register/

This allows you to create a register page using a third-party forms tool such as Gravity Forms and run it from a standard WordPress page.

If you’re not sure where to place this code I highly recommend you read How to create a WordPress plugin for your custom functions.

add_action( 'login_form_register', 'redirect_login_form_register' );

function redirect_login_form_register(){
    wp_redirect( home_url( '/register/' ) );
    exit(); // always call `exit()` after `wp_redirect`
}

 

Was this article helpful?

Related Articles