WordPress Security ServicesMalware Removal
Scan Findings Explained

WordPress User Enumeration: How Attackers Find Your Usernames, and How to Stop It

"User enumeration possible" means anyone can find out the usernames on your WordPress site. Scanners flag it, and attackers use it: knowing a real username makes password guessing easier. It's worth closing, but it's not your main line of defense. Here's how it works and how to block it.

Sergey By Sergey, WordPress security specialist Updated 1 min read
In this guide
  1. How usernames leak
  2. How serious is it?
  3. How to block it

How usernames leak

  1. Author archives. Visiting yoursite.com/?author=1 usually redirects to /author/username/. That reveals the username of user 1, often the main administrator.
  2. The REST API. yoursite.com/wp-json/wp/v2/users lists users who have published content, including their URL slug, which is often the username.
  3. Login error messages. WordPress tells you when a username exists but the password is wrong.
  4. 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.

Sergey, WordPress Security Specialist
About the author
Sergey, WordPress Security Specialist

10 years in WordPress security and incident investigation, and more than 200 websites cleaned of malware. Top Rated on Upwork with a 100% Job Success score. More about me

Frequently Asked Questions

Is user enumeration a vulnerability?

It's usually rated low: an information leak, not a way in by itself. It becomes a real risk only when combined with weak passwords or no login protection. That's why strong passwords and two-factor authentication matter more than hiding usernames.

Should I change my admin username from "admin"?

Yes, if you still use it. "admin" is the first username every bot tries. Create a new administrator with a different username, log in with it, and delete the old account, reassigning its content.

Will blocking the REST API users endpoint break anything?

For visitors who aren't logged in, it rarely does. Some plugins or headless setups do use it. The snippet below only hides it from logged-out visitors, so the block editor and admin keep working.

Need a hand?

Let me clean your WordPress site for you

Send me your site URL and what you're seeing. I'll reply with what I think is going on and the next step.

$95 per infected site · 1-month guarantee · direct contact with the specialist

Get My Site Cleaned →