Skip to content
  • Log In
  • Register
WordPress.org
  • News
  • Download & Extend
    • Get WordPress
    • Themes
    • Patterns
    • Plugins
    • Openverse
    • Mobile
    • Hosting
  • Learn
    • Learn WordPress
    • Documentation
    • Forums
    • WordPress.tv
    • Developers
  • Community
    • Make WordPress
    • WordCamp
    • Meetups
    • Photo Directory
    • Job Board
    • Five for the Future
  • About
    • About WordPress
    • Showcase
    • Gutenberg
    • Enterprise
  • Get WordPress
Get WordPress

Developer Resources

Browse: Home / Reference / Hooks / login_errors

apply_filters( 'login_errors', string $errors )

Filters the error messages displayed above the login form.

Contents

  • Parameters
  • Source
  • Related
    • Used By
  • Changelog
  • User Contributed Notes
    • Feedback

Parameters

$errors string
Login error message.

Top ↑

Source

File: wp-login.php. View all references

echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n";

View on Trac View on GitHub


Top ↑

Related

Top ↑

Used By

Used By
Used By Description
login_header() wp-login.php

Output the login page header.


Top ↑

Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    You must log in to vote on the helpfulness of this noteVote results for this note: -3You must log in to vote on the helpfulness of this note
    Contributed by Steven Lin — 2 years ago

    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;
    } );

    Top ↑

    Feedback

    • This gives me an Exception (Call to a member function get_error_codes() on null). — By lilmofo — 1 year ago

    Log in to add feedback

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

  • About
  • News
  • Hosting
  • Donate
  • Swag
  • Documentation
  • Developers
  • Get Involved
  • Learn
  • Showcase
  • Plugins
  • Themes
  • Patterns
  • WordCamp
  • WordPress.TV
  • BuddyPress
  • bbPress
  • WordPress.com
  • Matt
  • Privacy
  • Public Code
WordPress.org
WordPress.org
  • Visit our Facebook page
  • Visit our Twitter account
  • Visit our Instagram account
  • Visit our LinkedIn account
Code is Poetry

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.