Make WordPress Core

Changeset 54206


Ignore:
Timestamp:
09/19/2022 05:07:52 PM (9 months ago)
Author:
davidbaumwald
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r53827 r54206  
    11041104        <p id="nav">
    11051105            <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
    1106                 <?php echo esc_html( $login_link_separator ); ?>
    1107             <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a>
     1106            <?php
     1107
     1108            echo esc_html( $login_link_separator );
     1109
     1110            $html_link = sprintf( '<a href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
     1111
     1112            /** This filter is documented in wp-login.php */
     1113            echo apply_filters( 'lost_password_html_link', $html_link );
     1114
     1115            ?>
    11081116        </p>
    11091117        <?php
     
    14721480                }
    14731481
     1482                $html_link = sprintf( '<a href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
     1483
     1484                /**
     1485                 * Filters the link that allows the user to retrieve the lost password.
     1486                 *
     1487                 * @since 6.1.0
     1488                 *
     1489                 * @param string $html_link HTML link to the lost password form.
     1490                 */
     1491                echo apply_filters( 'lost_password_html_link', $html_link );
     1492
    14741493                ?>
    1475                 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a>
    14761494            </p>
    14771495            <?php
Note: See TracChangeset for help on using the changeset viewer.