Home » Wordpress

Log in to WordPress using an Email Address as well as username – without using any addon.

27 July 2012 No Comment

Hello friends,

Log in to WordPress using an Email Address – without using any addon.

Not required to install any third party addon.
Just you need to edit ONLY 2 LINES OF CODE.

Open wp-includes >> user.php
Look for below 2 lines, usually line no.29

if ( ! empty($_POST['log']) )
$credentials['user_login'] = $_POST['log'];

Just change that 2 lines with below.

if ( ! empty($_POST['log']) )
{
$user = get_user_by( 'email', $_POST['log'] );
if ( isset( $user, $user->user_login, $user->user_status ) && 0 == (int) $user->user_status ){ $_POST['log'] = $user->user_login; }
$credentials['user_login'] = $_POST['log'];
}

THATS IT.



Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.