To stop users signing in to WordPress with an email address while keeping username login, add a small callback to the authenticate filter. The example below rejects email-shaped login identifiers and lets ordinary usernames continue through WordPress’s normal authentication flow.
How WordPress email login works
WordPress’s standard login accepts either a username or an email address; its login guide labels the field “Username or Email Address.” WordPress Developer Resources: Logging In.
When authentication runs, WordPress applies the authenticate filter. Its wp_authenticate_email_password() callback handles email-and-password authentication, while wp_authenticate_username_password() handles username-and-password authentication. The hook reference documents the filter and its arguments. The wp_authenticate() reference says its identifier may be a username or email address and notes email support was added in WordPress 4.5.0.
Disable email login with a username-only rule
Add this code to a site-specific plugin or mu-plugin. It returns an authentication error when the submitted identifier is an email address; otherwise, it returns the existing result so WordPress’s regular username authentication can continue.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
- POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
- WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
- FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
- TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
- BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
<?php
/**
* Disable logging in with an email address; keep username login enabled.
*/
add_filter( 'authenticate', function ( $user, $username, $password ) {
if ( is_email( $username ) ) {
return new WP_Error(
'email_login_disabled',
__( 'Logging in with an email address is disabled. Use your username.' )
);
}
return $user;
}, 25, 3 );
The hook reference documents the filter’s submitted identifier and return values: a WP_User, WP_Error, or null. WordPress registers its username and email authentication callbacks at priority 20. This example runs at priority 25, after those callbacks, and returns an error for an email identifier so it cannot complete a successful email login. See the authenticate hook reference.
Install and test the change safely
- Choose a site-specific location. Put the code in a small site-specific plugin or mu-plugin, or use a snippets manager you already trust. A site-specific plugin or mu-plugin remains separate from the active theme, so a theme change does not remove the rule.
- Keep a recovery route available. Before activating the change, stay signed in to an administrator account and confirm its username. Know how you can disable the snippet through your site’s files or deployment mechanism if login access is lost.
- Test both login cases. While the administrator session remains active, try a valid username login and confirm an email-address login is rejected with the message in the code. Also test password reset and any alternate login integrations your site uses.
- Roll back if needed. If the rule interferes with your setup or prevents access, disable the plugin, mu-plugin, or snippet using your site’s available file or deployment recovery method.
Alternative: remove the email callback
You can instead remove WordPress’s email-and-password callback and add an explicit rejection:
Rank #2
- HARDWARE 2FA AND MFA: FIDO Alliance Certified FIDO2 v2.1 with CTAP2 plus legacy U2F and CTAP1 for strong two-factor login and passwordless sign-in on services that support security keys
- BUILDING ACCESS ON ONE CARD: MIFARE DESFire EV2 4K applet with AES encryption adds office door and physical access control alongside digital authentication
- CERTIFIED SECURE ELEMENT: An NXP Common Criteria EAL6+ certified secure controller and Java Card platform protects your keys on a tamper-resistant chip
- DUAL INTERFACE SMART CARD: Contactless NFC ISO 14443 plus ISO 7816 contact reader support in an ISO 7810 ID-1 format that is passive and needs no battery
- SWISS ENGINEERED DESIGN: Built by Cryptnox as a single card for authentication and access control and backed by a 2 year warranty
remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 );
add_filter( 'authenticate', function ( $user, $username ) {
if ( is_email( $username ) ) {
return new WP_Error(
'email_login_disabled',
__( 'Logging in with an email address is disabled. Use your username.' )
);
}
return $user;
}, 20, 3 );
A community code example uses this remove-and-block pattern: GitHub Gist example. Prefer the first approach when you want the policy to be explicit without removing a core callback. Do not remove that callback without checking whether another authentication extension relies on it; either approach can interact with other authentication filters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What this change does not cover
This changes the standard authenticate flow; it does not by itself define how every other authentication channel behaves. Review REST, XML-RPC, application-password, membership, and social-login integrations separately, and check their own settings or documentation if you need to restrict email-based access there. WordPress’s email-password function reference describes the email authentication callback, not the behavior of each third-party integration.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Rank #4
- Security Key : Protect your online accounts against unauthorized access by using FIDO2 and U2F authentication with T110. It's the world's most protective security key that works with windows, Mac OS, Linux as well as Chrome, Firefox, Edge and many other major browsers.
- Certified with the new FIDO2 standard, T110 provides the benefit of fast login and strong protection against phishing, account takeover as well as many other online attactks.
- Works with : Bank of America, Github, Google, Microsoft, DUO, Twitter, Facebook, Dropbox, Apple, ebay, BINANCE, mor and more.
- Fits USB-A port : Insert the T110 security key into the USB-A port of each service and log in conveniently with one touch
- For the driver download and user guide, please visit TrustKey Solutions Home support page.
Rank #3
- Ultra-Compact FIDO2 Security Key - Plug-and-stay or carry on a keychain. This USB-A hardware security key offers portable, always-on protection for desktop and mobile use. (Item Size: 0.75 X 0.74 IN x 0.25 IN)
- USB-A Hardware Key for All Devices - Works with USB-A ports on PC, Mac, Android, and other laptop/notebook device. Enables secure, cross-platform login with FIDO2.0 passkey support.
- FIDO Certified Security Key - Meets FIDO and FIDO2 standards. Works with Google, Microsoft, GitHub, Dropbox, and more. Please check service compatibility before purchase.
- Passwordless Login with Passkey - Supports passkey login via WebAuthn and CTAP2. Enjoy password-free sign-ins where supported. Not all websites or services currently support passkeys.
- Advanced Multi-Factor Authentication - Offers 200 FIDO2 passkey slots and 50 OATH-TOTP slots. Strong, flexible 2FA/MFA support across various apps and authentication platforms.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




