One of our users recently asked us how to disable WordPress’s login with the email feature, which was introduced in WordPress 4.5.
This feature allows users to log in with a username or an email address. However, some site owners prefer to turn this feature off for added security or to simplify the login process.
In this article, we’ll show you how to disable the login with the email address feature in WordPress.
Why Disable Login With Email in WordPress?
Some users believe that email addresses are more common knowledge than a username. If you send an email to someone, then they already know your email address.
If someone wants to break into your WordPress site, knowing an email address could potentially make it easier for them to break in by guessing your password or hacking your email account.
We don’t believe using an email address to log in makes a WordPress site less secure. You can always add more security layers like password-protecting the WordPress admin directory and adding two-step verification.
Having said that, we understand that some users may still want to disable login with email feature on their WordPress sites. Here are 2 methods for how you can easily do that:
- Method 1. Disable Login with Email in WordPress using Code (Recommended)
- Method 2. Disable Login with Email in WordPress using a Plugin
Let’s dive right in.
Method 1. Disable Login with Email in WordPress using Code (Recommended)
This method requires you to add code to your WordPress files. If you haven’t done that before, see our guide to pasting snippets from the web into WordPress.
To disable the login with the email feature, you’ll typically need to add the following code to your theme’s functions.php file or a code snippets plugin.
remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 );
To make it easier, you can use WPCode, which is the best code snippets plugin for WordPress.
WPCode has a built-in library with ready-to-use code snippets for all of the most popular WordPress feature requests, including disabling login with email, removing the WordPress version number, disabling comments, and more.
The best part is that you don’t need to edit your theme’s functions.php file at all. So, you eliminate the risk of breaking your WordPress website.
To get started, let’s install and activate the free WPCode plugin. If you need help, you can read our tutorial on how to install a WordPress plugin.
Once the plugin is activated, you’ll want to go to Code Snippets » Library from your WordPress admin dashboard.
Next, you can search for the ‘Disable Login by Email’ snippet and click on the ‘Use snippet’ button.
Then, WPCode will automatically add the code snippet and select the proper insertion method.
Here’s what it might look like in the WPCode editor:
From here, all you need to do is toggle the switch from ‘Inactive’ to ‘Active.’
Then, go ahead and click the ‘Update’ button.
That’s it!
This will not change anything on the login page, and users will still see that they can log in using either a username or email address. But if they enter the email address to log in, they will receive an invalid username error.
Method 2. Disable Login With Email in WordPress using a Plugin
You can also disable the login with the email feature with a single-use plugin – No Login by Email Address.
To do this, you first need to install and activate the plugin. For more details, feel free to refer back to our step-by-step guide on how to install a WordPress plugin.
The plugin works out of the box, which means that there are no settings to configure. Simply visit your WordPress site’s login screen and try logging in with your email address.
You can see that you get an invalid username error. The plugin will also change the ‘Username or Email address’ label to simply ‘Username.’
That’s all, we hope this article helped you disable login with email address feature in WordPress. Next, you may also want to see our guide on how to disable login hints in WordPress login error messages and our picks for the best WordPress login page plugins.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Jiří Vaněk
Since using an email address poses a security risk for me, especially because my email address is listed on the blog, I tried using method one with WP Code. It seems the least complicated and doesn’t burden the website in any way. Since I take access security to the admin area seriously, I find it important to disable the use of an email address and only use a login, preferably with two-factor authentication as well. The method with WP Code works perfectly.
momses
Hi,
Thanks for you article. I’m looking for a way to Login only By mail no Username.
Thanks in advance for you help.
Dom WO
Does this article also cover the registration form in woocommerce for the customers or it is only for the admin side login ?
Debra
Somehow it isn’t clear to me how to add a username once the email address login is disabled. Can you please explain.
Thanks so much
WPBeginner Support
If you have user registration enabled on your site, then those users can still register using their email addresses. But they will not be able to use the email address to login. They will have to use the username to login. As an administrator, you will also need to enter an email and user name when adding a new user.
Admin
Abdul Samad
Thank you for article
I want to know, how to allow login with mobile number
Second, I want to register my customer without email in wordpress
Please help me out with this
Thanks
Jeramy Queale
I simply couldn’t go away your website prior to suggesting that I really loved the usual information an individual provide in your visitors? Is gonna be back frequently to check up on new posts
Jayna Coppedge
I have a login to my wordpress blog. I have a different login for another wordpress blog I write with others. However when I want to comment on another wordpress blog. Neither user name or password works. I have not been willing to say change this long in because I am afraid it would affect the other 2. I don’t know what to call the 3 category to even look up the problem.
WPBeginner Support
We are not sure what you are trying to ask. But it seems like you probably have two self hosted WordPress.org accounts. And the websites you are trying to comment on are asking you to sign in with a WordPress.com account. Please see our guide on the difference between self hosted WordPress.org vs free WordPress.com blog.
Admin