In this guide
How usernames leak
- Author archives. Visiting
yoursite.com/?author=1usually redirects to/author/username/. That reveals the username of user 1, often the main administrator. - The REST API.
yoursite.com/wp-json/wp/v2/userslists users who have published content, including their URL slug, which is often the username. - Login error messages. WordPress tells you when a username exists but the password is wrong.
- Author names in posts, if your display name equals your username.
How serious is it?
Low on its own. Bots try common usernames and leaked credentials anyway. The real protection against password attacks is:
- strong, unique passwords;
- two-factor authentication for every administrator;
- limiting login attempts (see WordPress login security).
Blocking enumeration is a small extra on top of those, not a replacement.
How to block it
With a security plugin
Most security plugins (Wordfence, Solid Security, AIOS, Shield) have options to stop username discovery through author scans and the REST API, and to use generic login error messages.
Hide the REST API users list from logged-out visitors
In a small custom plugin or your child theme’s functions.php:
add_filter( 'rest_endpoints', function ( $endpoints ) {
if ( ! is_user_logged_in() ) {
unset( $endpoints['/wp/v2/users'] );
unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
}
return $endpoints;
} );
Block ?author= scans (Apache)
In .htaccess, inside the mod_rewrite section:
RewriteCond %{QUERY_STRING} ^author=\d+ [NC]
RewriteRule ^ - [F]
Use a display name that isn’t your username
In Users → Profile, set a nickname and choose it as “Display name publicly as”.
From my audit work: user enumeration is in nearly every scan report, and on its own it rarely matters. What I look for next is whether that discoverable admin account has two-factor authentication. If it does, enumeration is a cosmetic issue. If it doesn’t, enumeration plus a reused password is exactly how many sites get taken over.