Login & registration screens changes in WordPress 5.7

This devnotedev note Each important change in WordPress Core is documented in a developers note, (usually called dev note). Good dev notes generally include a description of the change, the decision that led to this change, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase. summarizes the changes related to the login and registration screens coming in WordPress 5.7.

Reset password screen user interface improvements

Previously, it was unclear that the displayed password is only being suggested and should be saved by clicking the Reset Password button. This change adds two separate “Generate Password” and “Save Password” buttons, for better clarity.

For reference, see ticketticket Created for both bug reports and feature development on the bug tracker. #39638.

A new hook to filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. the user data object during a password reset request

WordPress 5.7 also introduces the new lostpassword_user_data filter which allows for the user data object during a password reset request to be filtered. For example, It allows developers to perform custom validation using data other than username or email address.

The $errors object is also passed to the filter so developers are able to know of any existing error. This can be used in conjunction with the lostpassword_errors filter to remove an error from the error object if necessary.

For reference, see ticket #51924.

Changes related to the existing retrieve_password function

As part of the new feature in 5.7 that allows an Administrator to send a user a password reset link, the retrieve_password() function was moved from wp-login.php to wp-includes/user.php.

In addition the $user_login parameter was added to this function, to make it easier to use the function independently from the login screen.

For reference, see changesets [50129] and [50140].

A new hook to filter the “Back to blogblog (versus network, site)” link

In WordPress 5.7, a new login_site_html_link hook was added to allow developers to adjust the “Go to site” link displayed in the login page footer.

The only parameter of this filter is $link, which contains the full HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. link to display. Using this filter, developers are allowed to entirely replace the HTML link.

Example of use:

function wporg_login_site_html_link( $link ) {
        return '<a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Back to the website', 'text-domain' ) . '</a>';
}
add_filter( 'login_site_html_link', 'wporg_login_site_html_link', 10, 1 );

For reference, see ticket #35449.


Thanks @chaton666 and @johnbillion for proofreading this dev notedev note Each important change in WordPress Core is documented in a developers note, (usually called dev note). Good dev notes generally include a description of the change, the decision that led to this change, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase..

#5-7, #dev-notes