WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to remove the username field from the registration page?

I want the users to enter only their email and password.
A new user should be created based on these two parameters only.

Is that possible and if so, how?

share|improve this question
This do it? wordpress.org/extend/plugins/wp-email-login – saltcod May 16 '12 at 12:30

Absolutely YES, you can achieve this.

Rule 1: WordPress requires a username. We must provide a username.

Rule 2: Don't edit WordPress core code.

We can achieve this by hiding username field, get email and store it as username.

Step-1: Remove Username textfield

add_action('login_head', function(){
        #registerform > p:first-child{

    <script type="text/javascript" src="<?php echo site_url('/wp-includes/js/jquery/jquery.js'); ?>"></script>
    <script type="text/javascript">
            $('#registerform > p:first-child').css('display', 'none');

Step-2: Remove Username error

//Remove error for username, only show error for email only.
add_filter('registration_errors', function($wp_error, $sanitized_user_login, $user_email){

    return $wp_error;
}, 10, 3);

Step-3: Manipulate Background Registration Functionality.

add_action('login_form_register', function(){
    if(isset($_POST['user_login']) && isset($_POST['user_email']) && !empty($_POST['user_email'])){
        $_POST['user_login'] = $_POST['user_email'];

Put above code in your theme's functions.php file.

You can read complete description in reference link below.

Ref: http://www.thebinary.in/blog/remove-username-from-wordpress-registration/

You can also download a complete plugin to achieve this.

Plugin: https://wordpress.org/plugins/smart-wp-login/

share|improve this answer

@Nishant Kumar gave the perfect and should-be-accepted answer to this question. However there is a glitch after the Wordpress 4.0 version released. From codex-

Note: Since 4.0, these properties are private, see [28511].

registration_errors filter here requires a little modification.

//Remove error for username, only show error for email only.

add_filter('registration_errors', 'remove_username_empty_error', 10, 3);

function remove_username_empty_error($wp_error, $sanitized_user_login, $user_email){

    return $wp_error;

Note: As @mcnesium mentioned, if we completely got rid of the username field (in my case I used Theme my login plugin to override the regular registration form and there I just removed the username field) then $_POST['user_login'] will be null and condition won't match at all. We better remove that from the condition like @mcnesium suggested.

share|improve this answer

Step 3 in the post of Nishant Kumars post checks if isset($_POST['user_login']) which did not work for me, since the login is what we actually want to remove.

My solution is as follows (in the theme's functions.php), also as a separate function, to stay with the wordpress code style:

function copy_username_to_email (){
    if(isset($_POST['user_email']) && !empty($_POST['user_email'])){
        $_POST['user_login'] = $_POST['user_email'];
add_action('login_form_register', 'copy_username_to_email');
share|improve this answer

I think any solution to this request is going to be a 'hack' as wordpress requires that there be a username for all registered users. Even the plugin mentioned above is most likely just finding the username via the email address, and then using that username to login to the site.

If you are okay with a hack, here is a concept that could work:

1) Pre-populate the username field in your registration form with a unique number, using the current timestamp is a good idea to avoid ever getting any duplicates. You would then hide this field so that the user does not see it on the screen when filling out their form.

If you are using jQuery you could use something like:

$(document).ready(function() {
    var timestamp = (new Date).getTime();
    $('form input.username').val(timestamp);
    $('form input.username').css('display', 'none');

In this example, 'form input.username' would be the jQuery selector to find the username field, you will need to check the html structure on your page to make sure the selector matches the structure.

2) Use a plugin like the one mentioned earlier (http://wordpress.org/extend/plugins/wp-email-login/) to allow users to login with their email address.

share|improve this answer

Your Answer


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.