Title: wp_lostpassword_url
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_lostpassword_url( string $redirect ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#wp--skip-link--target)

Returns the URL that allows the user to reset the lost password.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#parameters)󠁿

 `$redirect`stringrequired

Path to redirect to on login.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#return)󠁿

 string Lost password URL.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#source)󠁿

    ```php
    function wp_lostpassword_url( $redirect = '' ) {
    	$args = array(
    		'action' => 'lostpassword',
    	);

    	if ( ! empty( $redirect ) ) {
    		$args['redirect_to'] = urlencode( $redirect );
    	}

    	if ( is_multisite() ) {
    		$blog_details  = get_site();
    		$wp_login_path = $blog_details->path . 'wp-login.php';
    	} else {
    		$wp_login_path = 'wp-login.php';
    	}

    	$lostpassword_url = add_query_arg( $args, network_site_url( $wp_login_path, 'login' ) );

    	/**
    	 * Filters the Lost Password URL.
    	 *
    	 * @since 2.8.0
    	 *
    	 * @param string $lostpassword_url The lost password page URL.
    	 * @param string $redirect         The path to redirect to on login.
    	 */
    	return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/general-template.php#L658)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L658-L685)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#hooks)󠁿

 [apply_filters( ‘lostpassword_url’, string $lostpassword_url, string $redirect )](https://developer.wordpress.org/reference/hooks/lostpassword_url/)

Filters the Lost Password URL.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#related)󠁿

| Uses | Description | 
| [get_site()](https://developer.wordpress.org/reference/functions/get_site/)`wp-includes/ms-site.php` |

Retrieves site data given a site ID or site object.

  | 
| [network_site_url()](https://developer.wordpress.org/reference/functions/network_site_url/)`wp-includes/link-template.php` |

Retrieves the site URL for the current network.

  | 
| [is_multisite()](https://developer.wordpress.org/reference/functions/is_multisite/)`wp-includes/load.php` |

Determines whether Multisite is enabled.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#)

| Used by | Description | 
| [wp_authenticate_email_password()](https://developer.wordpress.org/reference/functions/wp_authenticate_email_password/)`wp-includes/user.php` |

Authenticates a user using the email and password.

  | 
| [wp_authenticate_username_password()](https://developer.wordpress.org/reference/functions/wp_authenticate_username_password/)`wp-includes/user.php` |

Authenticates a user, confirming the username and password are valid.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#comment-content-661)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/#comment-661)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%23comment-661)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%23comment-661)
 4.  **Default Usage**
 5.      ```php
         <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" alt="<?php esc_attr_e( 'Lost Password', 'textdomain' ); ?>">
         	<?php esc_html_e( 'Lost Password', 'textdomain' ); ?>
         </a>
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%3Freplytocom%3D661%23feedback-editor-661)
 7.   [Skip to note 5 content](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#comment-content-662)
 8.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/#comment-662)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%23comment-662)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%23comment-662)
 10. **Lost Password and redirect to current page**
 11.     ```php
         <a href="<?php echo esc_url( wp_lostpassword_url( get_permalink() ) ); ?>" alt="<?php esc_attr_e( 'Lost Password', 'textdomain' ); ?>">
         	<?php esc_html_e( 'Lost Password', 'textdomain' ); ?>
         </a>
         ```
     
 12.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%3Freplytocom%3D662%23feedback-editor-662)
 13.  [Skip to note 6 content](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/?output_format=md#comment-content-663)
 14.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_lostpassword_url/#comment-663)
 15. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%23comment-663)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%23comment-663)
 16. **Lost Password and redirect to homepage**
 17.     ```php
         <a href="<?php echo esc_url( wp_lostpassword_url( get_home_url() ) ); ?>" alt="<?php esc_attr_e( 'Lost Password', 'textdomain' ); ?>">
         	<?php esc_html_e( 'Lost Password', 'textdomain' ); ?>
         </a>
         ```
     
 18.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F%3Freplytocom%3D663%23feedback-editor-663)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_lostpassword_url%2F)
before being able to contribute a note or feedback.