How to stop WordPress username enumeration on your site
To stop WordPress username enumeration, close the two public leaks that expose your login names: the ?author=1 redirect and the REST API users endpoint at /wp-json/wp/v2/users. You can shut both with a reputable security plugin or a few lines added to your theme functions or server config.
Username enumeration is not a break-in by itself. It is the easy first step before a brute-force or credential-stuffing attempt, because once an attacker knows a real username they only have to guess the password.
Our free external scan checks both leaks and tells you, in plain English, whether your site is handing out usernames to anyone who asks. Here is what it looks at and how to fix it properly.
What username enumeration actually is
WordPress can reveal valid account usernames through normal, public requests that need no login. A person or an automated bot does not need any special access to collect them.
The two leaks our scanner checks are the classic ones present in a default WordPress install:
- The author archive redirect: visiting yoursite.com/?author=1 redirects to /author/adminname/, exposing the username behind user ID 1. Bots count up through 2, 3, 4 and harvest the rest.
- The REST users endpoint: a request to /wp-json/wp/v2/users returns a JSON list of accounts and their slugs, often including administrators.
Why it matters for brute-force attacks
A login needs two things: a username and a password. By default WordPress effectively confirms when a username is real, because a wrong username and a wrong password can produce different login errors.
Once a bot has your real admin username, it can aim every guess at the password alone. Enumeration turns a two-part guessing game into a one-part one, which is why automated attacks so often start here. Closing the leak does not make you bulletproof, but it removes the attacker's easiest free clue.
Stop the enumeration with a plugin
If you would rather not touch code, a reputable security plugin can close both leaks for you. Most well-known WordPress login-hardening plugins include an option that blocks the ?author= redirect and restricts the REST users endpoint to logged-in users.
After enabling it, test the two URLs yourself, or re-run a scan, to confirm the leak is actually closed. Some plugins only block one of the two routes, so check both.
Stop it with a few lines of config
If you are comfortable editing your theme's functions.php or your web server config, you can block both leaks directly. Three common approaches:
- Block ?author= scanning: in functions.php, detect a front-end request carrying the author query variable and stop it before WordPress issues the redirect, so /?author=1 returns nothing useful.
- Restrict the REST users route: filter the REST response so /wp-json/wp/v2/users returns an authentication error to anyone not logged in, rather than the public list.
- Server level: deny the ?author= pattern and the wp-json users route in Apache or Nginx, catching the request before it reaches WordPress.
Free, instant, no account
See your site's security grade in seconds.
Free, instant, and no account needed to see your grade.
Scan my site freePlain-English A to E grade in about 10 seconds. No account needed to see it.
Sensible extra hardening
Stopping enumeration is one layer. Pair it with a few habits that make a stolen username far less useful:
- Avoid an account literally named admin, and set a public display name (nickname) that differs from the login username.
- Use long, unique passwords and turn on two-factor authentication for every administrator.
- Add login rate-limiting or lockouts so even a known username cannot be brute-forced quickly.
- Keep WordPress core, plugins and themes updated.
How the free EB Security scan checks this
Our scan is an external, passive read of what your site already serves in public. For this topic it requests the ?author= URL and the /wp-json/wp/v2/users endpoint and reports whether either leaks a username, with a severity and a plain fix.
Be clear on the limits. The scan only checks WordPress core behaviour like this, plus the readme file, xmlrpc and the core version against the latest release. It does not log in, does not brute-force, and does not test your plugins or themes for vulnerabilities. It is a passive external check, not a malware scan: a clean result here does not prove your whole site is secure. Treat it as a fast first signal, apply the fixes above, then keep monitoring.
Username enumeration hands attackers your login names for free. Close the ?author= redirect and the REST users endpoint with a plugin or a few lines of config, then add two-factor authentication and login limits so a known username still gets nobody in.