I'm trying to redirect a user after they have reset their password. I'm using the following code, based on an example from the wordpress docs.

add_filter( 'lostpassword_redirect', 'my_redirect_home' );
function my_redirect_home( $lostpassword_redirect ) {
    return home_url() . '/my-account/';

As far as I can tell, the filter is never hit. I've tried replacing the return with an exit; but nothing changes. This seems pretty straight forward. Am I missing something?

Edit: To clarify, I want to redirect them after they have entered their new password and it has been accepted. I want to redirect them to the login form so that they can use the password they've just set up.

  • You mean redirecting after you press "Get New Password" on the /wp-login.php?action=lostpassword page ? What's the landing page for the above code? Any other redirects from your /my-account/ page? – birgire May 12 '16 at 11:39

I was missing something. Woocommerce accounts are different from normal Wordpress accounts. The code that I was looking for was:

function woocommerce_new_pass_redirect( $user ) {
  wp_redirect( get_permalink(woocommerce_get_page_id('myaccount')));

add_action( 'woocommerce_customer_reset_password', 'woocommerce_new_pass_redirect' );

I found it on stackoverflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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