apply_filters( ‘lostpassword_url’, string $lostpassword_url, string $redirect )

Filters the Lost Password URL.


The lost password page URL.
The path to redirect to on login.

More Information

The filter is applied to the URL returned by the function wp_lostpassword_url() , allowing the developer to have that function direct users to a specific (different) URL for retrieving a lost password.


return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );



User Contributed Notes

  1. Skip to note 2 content

    Example migrated from Codex:

    The following example would return a lost password URL for the wp_lostpassword_url() function:

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

You must log in before being able to contribute a note or feedback.