Login ID Type
By default, WordPress lets users log in with either their username or email address. That’s flexible, but it also gives attackers two things to guess. Want to reduce that attack surface? This module lets you restrict login to username-only (blocking email enumeration) or email-only (for email-centric workflows).
Use Cases
- Prevent email enumeration by requiring username-only login
- Simplify login for users who always forget their username (email-only)
- Standardize login behavior across your organization
- Reduce attack surface by limiting authentication options
- Match login requirements to your user management workflow
How It Works
Navigate to Switchboard → Security → Login ID Type and choose your mode:
| Mode | What Users Enter | Error Message |
|---|---|---|
| Both (Default) | Username or email | Normal WordPress behavior |
| Username Only | Username | “Please login with your username, not email.” |
| Email Only | Email address | “Please login with your email address, not username.” |
The restriction is enforced at the authentication level — before WordPress checks the password.
Settings
| Setting | Options | Default |
|---|---|---|
| Login ID Type | Both / Username Only / Email Only | Both |
Why Restrict Login Type?
Username Only Benefits
- Blocks email enumeration — Attackers can’t verify if an email exists on your site
- Separates public and private info — Emails are often public; usernames can be private
- Reduces attack surface — Only one identifier to guess
- Consistent with security policies — Some organizations require username-based auth
Email Only Benefits
- Easier for users — People remember their email better than usernames
- Natural for email-centric sites — E-commerce, memberships, newsletters
- Avoids “what was my username?” problem — Everyone knows their email
- Works well with SSO — Email-based identity is standard for integrations
What Users See
When someone tries to log in with the wrong type:
Username Only mode, user enters email:
“Please login with your username, not email.”
Email Only mode, user enters username:
“Please login with your email address, not username.”
The error appears immediately, before password validation.
Email Enumeration Attack
Here’s why “username only” can improve security:
The attack:
- Attacker has a list of email addresses
- They try each as a WordPress login
- WordPress says “invalid email” vs “incorrect password”
- Different messages reveal which emails have accounts
With username only:
- Attacker can’t use email addresses at all
- They must know usernames to even attempt login
- Email list is useless for reconnaissance
Modern WordPress tries to use generic error messages to prevent enumeration, but forcing username-only is an extra layer of protection.
Registration Considerations
This module affects login only, not registration:
- Users can still register with their email
- Password reset still uses email
- Only the login form behavior changes
If you use email-only login, make sure your users know to:
- Register with their email (as normal)
- Log in using that same email address
Verification
After configuring:
- Log out of WordPress
- Go to the login page
- Try logging in with the restricted type
- Should see the appropriate error message
- Log in with the allowed type — should work normally
FAQ
What if users forget which to use?
The error message tells them exactly what to use. You can also customize your login page (via theme or plugin) to indicate “Enter your username” or “Enter your email”.Does this affect wp-login.php only or other login methods too?
It hooks into WordPress authentication, so it affects any login that uses the standard WordPress authentication system — wp-login.php, login forms in themes, WooCommerce, etc.Can users still reset passwords with their email?
Yes. Password reset is separate from login authentication. Users can request password resets using their email regardless of this setting.What about the REST API?
The REST API uses different authentication mechanisms (Application Passwords, cookies, etc.). This module specifically targets form-based login where users enter credentials.Will this affect SSO or social login?
SSO and social login plugins typically bypass the standard WordPress authentication flow. They should continue to work. Test with your specific SSO plugin to confirm.What happens if I change from email-only to username-only?
Users who’ve been logging in with email will need to use their username instead. Make sure to communicate the change. Their accounts still work — only the login method changes.Combining with Other Security Modules
For comprehensive login security:
| Module | Protection |
|---|---|
| Login ID Type | Control what credentials are accepted |
| Limit Login Attempts | Block brute force after failed attempts |
| Username Blacklist | Prevent risky usernames from existing |
| Disable XML-RPC | Block XML-RPC brute force attacks |
Together, these create multiple layers of login protection.
For maximum security: Use “Username Only” combined with strong, unique usernames that aren’t publicly visible (don’t use author slugs as usernames).
Get access to all 147 modules with a single license