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 login 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.
最近,我们的一位用户问我们如何禁用WordPress 4.5中引入的禁用电子邮件登录功能。 此功能允许用户使用登录名中的用户名或电子邮件地址登录。 在本文中,我们将向您展示如何在WordPress中禁用使用电子邮件地址的登录功能。
为什么要禁用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.
如果有人想闯入您的WordPress网站,那么知道一个电子邮件地址可能会使他们更容易通过猜测密码或入侵您的电子邮件帐户来闯入。
We don’t believe that using an email address to login makes a WordPress site any less secure. You can always add more security layers like password protecting WordPress admin directory, and adding two-step verification.
我们不认为使用电子邮件地址登录会降低WordPress网站的安全性。 您可以随时添加更多安全层,例如保护WordPress管理员目录的密码 ,并添加两步验证 。
For WordPress security, we use Sucuri on all our sites. See how Sucuri helped us block 450,000 WordPress attacks in 3 months
为了WordPress的安全性,我们在所有站点上都使用Sucuri 。 了解Sucuri如何帮助我们在3个月内阻止450,000次WordPress攻击
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.
话虽如此,我们了解到某些用户可能仍想在其WordPress网站上禁用使用电子邮件功能的登录。 让我们看看如何轻松地做到这一点。
使用插件在WordPress中禁用电子邮件登录 (Disable Login With Email in WordPress using a Plugin)
First thing you need to do is install and activate the No Login by Email Address plugin. For more details, see our step by step guide on how to install a WordPress plugin.
您需要做的第一件事是安装并激活“ 不通过电子邮件地址登录”插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。
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.
该插件可以直接使用,没有可供您配置的设置。 只需访问WordPress网站的登录屏幕,然后尝试使用电子邮件地址登录即可。
You will get an invalid username error. The plugin will also change label ‘Username or Email address’ to simply username.
您将收到无效的用户名错误。 插件还会将标签“用户名或电子邮件地址”更改为简单的用户名。
在WordPress中手动禁用电子邮件登录 (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.
这种方法很简单,但不是很干净。 只需将此代码添加到主题的functions.php文件或特定于站点的插件中即可 。
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. You may also want to see our guide on how to disable login hints in WordPress login error messages.
仅此而已,我们希望本文能帮助您禁用WordPress中具有电子邮件地址功能的登录。 您可能还想查看有关如何在WordPress登录错误消息中禁用登录提示的指南。
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.
如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/plugins/how-to-disable-login-with-email-address-feature-in-wordpress/