WordPress template tags WP_ lostpassword_ URL is used to output the password address, through which the user can reset the password.
wp_lostpassword_url( string $redirect = '' )
Function parameters
$redirect
String value, null by default
Provide a URL. When the user finds the password, he will jump back to this URL. Generally, the URL of the current page is provided
Examples of function usage
When the user retrieve the password, return to the home page of the website
<a href="<?php echo wp_lostpassword_url( home_url() ); ?>">Forget the password?</a>
In the article page, the user returns to the current article page after retrieving the password
<a href="<?php echo wp_lostpassword_url( get_permalink() ); ?>">Forget the password?</a>
No matter which page the user clicks to retrieve the password, the user will return to the previous page after completing the password retrieval operation
<a href="<?php echo wp_lostpassword_url( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); ?>">Forget the password?</a>
Extended reading
wp_ lostpassword_ The url() function is located at: WP includes / general- template.php
Related tags:
- is_ user_ logged_ in()
- wp_ login_ form()
- wp_ loginout()
- wp_ logout()
- wp_ register()
- wp_ login_ url()
- wp_ logout_ url()
- wp_ registration_ url()