Recently one of our users asked us how to disable login with email on WordPress introduced in WordPress 4.5 .This feature allows users to login with the username or their email address in the online form connection. In this tutorial, we will show you how to disable login with email address in WordPress.

Why Disable Login with Email in WordPress?

Some users think that email addresses are known to everyone you email to. And therefore, is a breach in the WordPress login system.

If someone wants to brute force your WordPress blog, already having your email address, the next step for them will be to guess your passwords.

We don't believe that using an email address to log in makes a WordPress site less secure. You can always add multiple layers of security like password protecting WordPress admin directory or add two step verification.

However, we understand that some users want to disable logging in with email on their WordPress sites. Let's see how you can easily set this up.

Disable login with email on WordPress with a plugin

The first thing you need to do is to install and activate the plugin No Login by Email Address. For more details, see our step-by-step guide on way to install a WordPress plugin.

The plugin works without configuration, and there are no settings to configure. Just visit your WordPress site's login screen and try to login with an email address.

You will get an error when it does. The plugin will also modify the label " Username or email address  " for " username Simply.

WordPress connection error

How to disable login with email manually

This method is simple but not very clean. Just add this code to your WordPress plugin .

Remove_filter ('authenticate', 'wp_authenticate_email_password', 20);

It won't change anything on the login page and users will still be able to see that they are offered to use their email address, and as long as they do, they will not be able to login.

You can also add this combined action to a filter.

Function login_function () {add_filter ('gettext', 'username_change', 20, 3); Function username_change ($ translated_text, $ text, $ domain) {if ($ text == 'Username or Email') {return "Username (Only)"; } Return $ translated_text; }} Add_action ('login_head', 'login_function');

Now you will also be able to ask users to use the username only.

That's all for this tutorial, I hope it will be of great use to you. If you have any questions, you can post them in the online form below.