1

How to redirect users to custom lostpassword page when they click on the Error: Lost your password?. Because I set a redirect for wp-login.php to my custom login page. when a user click on Error: Lost your password? it requests for wp-login.php and then automatically redirects to custom login page. I know the function is present on wp-login.php file but I don't know what changes shall I make to make this possible. Please help. I have also renamed wp-login.php.

1

1 Answer 1

1

If you only want to adjust the link of the lost password page, then there is a designated filter for that:

function wpse_133647_custom_lost_password_page() {
    return home_url('/lost-password');
} // function wpse_133647_custom_lost_password_page
add_filter('lostpassword_url', 'wpse_133647_custom_lost_password_page');
3
  • Thanks for your reply I used this code to redirect add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_redirect('http://mydomain.com/login'); exit(); } } can please tell me what changes shall I make. I am a newbie to PHP and wordpress. Please help me. Feb 6, 2014 at 14:05
  • What you have to do depends on what you want to do. If you want to provide your users a custom login page as well as a custom lost password, your implementation looks different from the one for using a custom login page and the default page for lost password. So what is it that you want to do?
    – tfrommen
    Feb 6, 2014 at 14:09
  • I want custom login page and custom lostpassword page. Actually I am using theme my login plugin. But after using rename wp-login plugin I have to manually redirect. So I want custom login page and custom lostpassword page. Please help. Feb 6, 2014 at 14:14

Your Answer

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

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