Login and Registration: Add a new filter for the lost password link.

On the login page, the "Register" link for new users has been filterable for some time.  This change adds the ability to filter the "Lost your password?" link as well.

Props wparslan, audrasjb, rafiahmedd, SergeyBiryukov, antonvlasenko, hellofromTonya.
Fixes #55388.

git-svn-id: https://develop.svn.wordpress.org/trunk@54206 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald 2022-09-19 17:07:52 +00:00
parent 45860af625
commit 4a9e86841f

View File

@ -1103,8 +1103,16 @@ switch ( $action ) {
<p id="nav">
<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
<?php echo esc_html( $login_link_separator ); ?>
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a>
<?php
echo esc_html( $login_link_separator );
$html_link = sprintf( '<a href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
/** This filter is documented in wp-login.php */
echo apply_filters( 'lost_password_html_link', $html_link );
?>
</p>
<?php
@ -1471,8 +1479,18 @@ switch ( $action ) {
echo esc_html( $login_link_separator );
}
$html_link = sprintf( '<a href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
/**
* Filters the link that allows the user to retrieve the lost password.
*
* @since 6.1.0
*
* @param string $html_link HTML link to the lost password form.
*/
echo apply_filters( 'lost_password_html_link', $html_link );
?>
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a>
</p>
<?php
}