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.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 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');
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0