Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can i allow users to login to my wordpress site using both email id and username? Currently it is allowing only username.

share|improve this question
1  
Sorry, plugin/theme recommendations are off topic here. Try the WordPress group on Google+ or wordpress.org forums –  Bainternet Mar 11 '13 at 13:21

1 Answer 1

up vote 1 down vote accepted

Here you got a small plugin. If you don't (or can't) use a plugin, this should - in theory - as well work from within your functions.php file. Just leave the plugin comment header out.

<?php
/** Plugin Name: (#90328) Login with E-Mail address */
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' );

Hope this helps.

share|improve this answer
    
I edited your question as this is plugin territory and shouldn't be part of a theme. I left your statement in, but offered it as plugin as well. –  kaiser Mar 11 '13 at 13:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.