Page to recovery password not found

I’m using the s2member widget to let users login and to access to the lost password page. But this link redirects to “/lost-password” and the page does not exist. I think that I have missed something in the config of s2member. Could you help me please?

It sounds like you have another plugin running that is regulating logins, password, or security, and it is conflicting with s2Member.

You can either try tracking down the problem, or else try using the Sidebar Login plugin to provide the login widget instead: https://wordpress.org/plugins/sidebar-login/

Not sure but It seems that Woocommerce has something to do about this problem. Anyway, I’ve forced the correct lost password page with this function:

function wpse_133647_custom_lost_password_page() {
    return home_url('/wp-login.php?action=lostpassword');
} // function wpse_133647_custom_lost_password_page
add_filter('lostpassword_url', 'wpse_133647_custom_lost_password_page');

Case solved.

Useful function to know – thanks for posting it here!

Neither of these work for me - it would appear to be woocommerce but not sure how or why it is doing it. The widget also just goes to the same non-working link: mysite.com/someproduct/my-account/lost-password/

mysite.com/lost-password no longer works at all…

Neither of these work for me

Nigel, it’s just one thing. You need the whole code (except for the bit prefaced by \\). In other words:

function wpse_133647_custom_lost_password_page() {
    return home_url('/wp-login.php?action=lostpassword');
} 
add_filter('lostpassword_url', 'wpse_133647_custom_lost_password_page');

Note: I don’t use WooCommerce, so I can’t comment on whether it works, but that’s the relevant code.

But I’d suggest something slightly different. Try this:

function my_lost_password_page( $lostpassword_url, $redirect ) {
    return home_url( '/lost-password/?redirect_to=' . $redirect );
}
add_filter( 'lostpassword_url', 'my_lost_password_page', 10, 2 );

That should redirect to mysite.com/lost-password/

thanks but mysite.com/lost-password does not work if I put this in a browser window

What URL are you trying to reach?

Also @enquirer32, are you using multisite?

Thanks Tim, I have solved it - there was a custom function I had applied concerning some javascript and it in some way interfered with my code - which works fine :

function reset_pass_url() {
$siteURL = get_option(‘siteurl’);
return “{$siteURL}/wp-login.php?action=lostpassword”;
}
add_filter( ‘lostpassword_url’, ‘reset_pass_url’, 11, 0 );

Okay, I’m still lost. I’ve got s2Member and WooCommerce. My password reset is gone. I’ve tried inserting each of these codes into the functions.php file, but none of them seem to work. Anyone got an idea? Am I putting the code in the wrong spot?

I’ve found what appears to be a bit of a workaround, though it’s clunkier than I’d like. I added a manual link to my join page: http://www.mysite.com/wp-login.php?action=lostpassword
This doesn’t fix the link provided by s2Member, but at least it’s right there when the user gets sent to the wrong place. If there was a way to edit that link in s2Member, I’d be interested in finding it.

s2Member doesn’t provide such a link. It just customizes the WP login page. So the link is provided by WP itself.

1 Like