I’ve successfully been able to redirect the default wp_login.php used for all login/registration/password reset to custom pages with the following filters:
add_filter ( 'login_url', xxfunctionnamexx )
and
add_filter ( 'register_url', xxfunctionnamexx )
I’ve created the frontend login from with the default wp_login_form()
function and the registration form with Gravity Forms. However, I’m really have trouble with the “reset password” form and “forgot password” form.
I’ve been able to get the redirect working with the lostpassword_url
filter (see below).
function custom_lostpassword_url( $register_url="", $redirect="" ) {
$page = get_page_by_path( 'reset-password' );
if ( $page ) {
$lostpassword_url = get_permalink( $page->ID );
if (! empty( $redirect ) )
$lostpassword_url = add_query_arg( 'redirect_to', urlencode($redirect), $lostpassword_url );
}
return $lostpassword_url;
}
add_filter( 'lostpassword_url', 'custom_lostpassword_url', 10, 2 );
However, I’m having trouble getting the “forgot password” to work. I’ve tried using this method – Check for correct username on custom login form – but it throws an “expired key” error when the link retrieved in email is clicked.
Then I tried this method, which works (no expired key). However, it redirects back to the default “reset password” page (within wp-login.php) – where the user can create a new password. I’d like to create a frontend form for this, too.
Can anyone help – or is this simply not doable?