Leave a Reply

1 comment

  1. In your plugin you would first set the redirect URL either to nothing: $redirect=''; or the fully qualified URL of the page you want your user to land on after successfully changing their password. For http://example.com/mypage/ you would use: $redirect=site_url( '/mypage/ ' );

    Then your form would be:

    <form name="lostpasswordform" id="lostpasswordform" action="<?php echo wp_lostpassword_url(); ?>" method="post">
        <p>
            <label>Username or E-mail:<br>
            <input type="text" name="user_login" id="user_login" class="input" value="" size="20" tabindex="10"></label>
        </p>
        <input type="hidden" name="redirect_to" value="<?php echo $redirect ?>">
        <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="Get New Password" tabindex="100"></p>
    </form>
    

    Note: This code is untested. Let me know what happens in the comments if something doesn’t work.

    Update

    As noted in the comments, if you have a filter on login_url wp_lostpassword_url() will point to your custom page. To temporarily restore the default login_url, remove the filter right before the form code:

    remove_filter( 'login_url', 'your_filter_function' );
    

    and add it back right after the form code:

    add_filter( 'login_url', 'your_filter_function' );