A client recently asked me how to change the default login function in WordPress so that users access the website with their email address, instead of a username.
In short, this can be done in three steps:
- Remove default authentication function
- Add custom authentication function
- Change text “Username” in wp-login.php to “Email”
Note: Don’t edit core files.
1. Remove WordPress default authentication function.
WordPress uses “authenticate” filter to perform additional validation at user login.
2. Add custom authentication function
3. Change text “Username” in wp-login.php to “Email”
We can use gettext filter to change text “Username” to “Email” without editing core files.