Login to WordPress admin area via email or login
Often met the opportunity on the sites login via email. Today I found how to embed this feature in the site on WordPress. To activate the feature, you can simply paste the following code into the function.php file.
function login_with_email_address($username) {
$user = get_user_by('email',$username);
if(!empty($user->user_login))
$username = $user->user_login;
return $username;
}
add_action('wp_authenticate','login_with_email_address');
function change_username_wps_text($text){
if(in_array($GLOBALS['pagenow'], array('wp-login.php'))){
if ($text == 'Username'){$text = 'Username / Email';}
}
return $text;
}
add_filter( 'gettext', 'change_username_wps_text' );Code checked, everything works great. Good luck with development.
/*

Online tutoring services. List of courses I teach
*/- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.




