A set of WordPress filters to direct links to user forms to front end versions
<?php
/**
* This is a set of filters to change links for login, register,
* and forgot password to direct to front-end pages. All three
* can be used together, or any single filter can be used as
* needed. Note that the urls given for each are example only.
* You will need to set these accordingly (and each would need
* to have the appropriate form, which is separate from this).
*/
add_filter( 'login_url', function ( $login_url, $redirect ) {
return home_url( '/my-login-page/?redirect_to=' . $redirect );
}, 10, 2 );
add_filter( 'register_url', function ( $register_url ) {
return home_url( '/register/' );
} );
add_filter( 'lostpassword_url', function ( $lostpassword_url, $redirect ) {
return home_url( '/lostpassword/?redirect_to=' . $redirect );
}, 10, 2 );