On this page
wp_lostpassword_url( string $redirect = '' ): string
Returns the URL that allows the user to reset the lost password.
Parameters
$redirectstring Optional-
Path to redirect to on login.
Default:
''
Return
string Lost password URL.
Source
File: wp-includes/general-template.php. View all references
function wp_lostpassword_url( $redirect = '' ) {
$args = array(
'action' => 'lostpassword',
);
if ( ! empty( $redirect ) ) {
$args['redirect_to'] = urlencode( $redirect );
}
if ( is_multisite() ) {
$blog_details = get_blog_details();
$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 );
}
Hooks
- apply_filters( 'lostpassword_url',
string $lostpassword_url ,string $redirect ) -
Filters the Lost Password URL.
Related
Uses
| Uses | Description |
|---|---|
| network_site_url() wp-includes/link-template.php | Retrieves the site URL for the current network. |
| get_blog_details() wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| is_multisite() wp-includes/load.php | If Multisite is enabled. |
| add_query_arg() wp-includes/functions.php | Retrieves a modified URL query string. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| wp_authenticate_email_password() wp-includes/user.php | Authenticates a user using the email and password. |
| wp_authenticate_username_password() wp-includes/user.php | Authenticates a user, confirming the username and password are valid. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_lostpassword_url