WordPress is a popular website platform. It is user-friendly and flexible. But, sometimes, you need to change some settings. One such setting is the login feature. By default, WordPress allows logging in with an email address. You might want to disable this for security reasons. In this guide, we will show you how to do it.

Credit: help.solidwp.com
Why Disable Login With Email Address?
There are several reasons to disable the login with email feature. Here are a few:
- Email addresses are easy to guess. This makes your site less secure.
- Hackers may target email addresses for attacks.
- Using a username can add an extra layer of security.
Steps to Disable Login With Email Address
Disabling this feature involves a few steps. Follow these steps carefully.
1. Backup Your Website
Before making any changes, backup your website. This ensures you do not lose any data. You can use plugins like UpdraftPlus or BackWPup.
2. Install And Activate A Code Snippet Plugin
To add custom code, install a code snippet plugin. Here are some popular plugins:
- Code Snippets
- WPCode – Insert Headers and Footers
- My Custom Functions
After installing, activate the plugin. This will allow you to add custom code to your WordPress site.
3. Add Custom Code To Disable Email Login
Now, add the custom code to disable email login. Follow these steps:
- Go to your WordPress dashboard.
- Click on “Snippets” in the menu.
- Click on “Add New” to create a new snippet.
- Enter a title for your snippet. For example, “Disable Email Login”.
- Copy and paste the following code into the code box:
function disable_email_login( $username ) {
if ( is_email( $username ) ) {
$username = '';
}
return $username;
}
add_filter( 'authenticate', 'disable_email_login', 20 );
- Click on “Save Changes and Activate”.
4. Test The Changes
After adding the code, test the changes. Log out of your WordPress site. Try to log in with your email address. You should not be able to log in with an email address. Instead, use your username to log in.
What If Something Goes Wrong?
Sometimes, things might not work as expected. Here are some steps to troubleshoot:
- Check the code snippet for any errors.
- Deactivate the snippet to see if the problem persists.
- Restore your website from the backup you created.
- Contact your hosting provider for help.

Credit: www.wpbeginner.com
Frequently Asked Questions
How Do I Disable Login With Email In WordPress?
Go to your WordPress settings. Find the option to disable email login.
Can I Disable Email Login Without A Plugin?
Yes, modify your theme’s functions. php file. Add the necessary code snippet.
Why Disable Login With Email In WordPress?
To enhance security by limiting login methods. Reduce potential attack vectors.
Does Disabling Email Login Affect User Experience?
It may. Users must remember their usernames. Inform them beforehand for a smooth transition.
Conclusion
Disabling login with an email address can make your site more secure. Follow the steps outlined in this guide. Always remember to backup your site before making changes. If you face any issues, troubleshoot using the steps mentioned. With these steps, you can easily disable the email login feature in WordPress.