Is it possible to remove username field from the registration page? If so, how?

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?


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 also download a complete plugin to achieve this.


Leave a Comment