disableloginemail-1
How to Disable Login With Email Address Feature in WordPress
December 6th, 2018 in Wordpress |

Recently, one of our users asked us how they can the disable login with email feature introduced in WordPress 4.5. This feature allows users to log in with username or email address in the login form. In this article, we will show you how to disable login with 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.

Having said that, we understand that some users may still want to disable login with email feature on their WordPress sites. Let’s see how you can easily do that.

Disable Login With Email in WordPress using a Plugin

The first thing you need to do is install and activate the “No Login by Email Address” plugin.

The plugin works out of the box, and there are no settings for you to configure. Simply visit the login screen of your WordPress site and try login in with email address.

You will get an invalid username error. The plugin will also change label ‘Username or Email address’ to simply username.

emailloginremoved

Manually Disable Login with Email in WordPress

This method is simple but not very clean. Simply add this code to your theme’s functions.php file or a site-specific plugin.

1
remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 );

It will not change anything on the login page and users will still see that they can login using either username or email address. But if they enter the email address to login, it will give them an invalid username error.

That’s all, we hope this article helped you disable login with email address feature in WordPress.