Skip to content

Commit

Permalink
Login and Registration: Use correct variable to display a single erro…
Browse files Browse the repository at this point in the history
…r message.

When the `wp_login_errors` filter is used to add an error message followed by an instructional message, the former was not displayed and the latter was errouneously displayed twice above the login form.

This commit ensures that the error message is displayed as expected.

Follow-up to [56654].

Props mapumba.
Fixes #59983.

git-svn-id: https://develop.svn.wordpress.org/trunk@57142 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Nov 29, 2023
1 parent a21f5a3 commit 96339bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,18 @@ function login_header( $title = 'Log In', $message = '', $wp_error = null ) {

$errors .= '</ul>';
} else {
$errors .= '<p>' . $error_message . '</p>';
$errors .= '<p>' . $error_list[0] . '</p>';
}

/**
* Filters the error messages displayed above the login form.
*
* @since 2.1.0
*
* @param string $errors Login error message.
* @param string $errors Login error messages.
*/
$errors = apply_filters( 'login_errors', $errors );

wp_admin_notice(
$errors,
array(
Expand All @@ -287,6 +288,7 @@ function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
* @param string $messages Login messages.
*/
$messages = apply_filters( 'login_messages', $messages );

wp_admin_notice(
$messages,
array(
Expand Down

0 comments on commit 96339bd

Please sign in to comment.