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?
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?
You must be logged in to post a comment.
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
Step-2: Remove Username error
Step-3: Manipulate Background Registration Functionality.
Put above code in your theme’s functions.php file.
You can also download a complete plugin to achieve this.
Plugin: https://wordpress.org/plugins/smart-wp-login/
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:
@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–
registration_errors
filter here requires a little modification.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 benull
and condition won’t match at all. We better remove that from the condition like @mcnesium suggested.Iterating on @nishant-kumar’s answer, here is a vanilla JS, no extra js script, 1 step, no backend edit needed, solution to make a sign up form with only the email input :
You just need to add this code in your functions.php file (or in your custom plugin, if you have one)
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:
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.