apply_filters( ‘login_errors’, string $errors )

Filters the error messages displayed above the login form.

Parameters

$errorsstring
Login error message.

Source

$errors = apply_filters( 'login_errors', $errors );

Changelog

VersionDescription
2.1.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example migrated from Codex:

    The following callback removes the ‘password reminder’ link from the two main login error messages.

    add_filter( 'login_errors', function( $error ) {
    	global $errors;
    	$err_codes = $errors->get_error_codes();
    
    	// Invalid username.
    	// Default: '<strong>ERROR</strong>: Invalid username. <a href="%s">Lost your password</a>?'
    	if ( in_array( 'invalid_username', $err_codes ) ) {
    		$error = '<strong>ERROR</strong>: Invalid username.';
    	}
    
    	// Incorrect password.
    	// Default: '<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s">Lost your password</a>?'
    	if ( in_array( 'incorrect_password', $err_codes ) ) {
    		$error = '<strong>ERROR</strong>: The password you entered is incorrect.';
    	}
    
    	return $error;
    } );

You must log in before being able to contribute a note or feedback.