· 7 min read · Mert Tati
How to Hide WordPress Usernames: A Guide to Stopping Username Enumeration
Your WordPress username can leak via the REST API, ?author=1 and the sitemap. What username enumeration is, how to test for it and how to shut it down.
Short answer: By default, WordPress exposes usernames through the REST API user list, the ?author=1 redirect, author archive URLs, the sitemap, oEmbed data and login error messages that differ depending on what went wrong. To hide usernames, you need to close these sources to logged-out visitors, reduce login errors to a single generic message and make your display name different from your username. Then test your site yourself to confirm the leak is really closed.

What is username enumeration, and why does it matter?
Username enumeration is when an attacker collects the valid usernames on a site one by one. Every login attempt has two unknowns: the username and the password. If the username is known, the attacker only has to guess the password, so half the job is already done. Harvested usernames are also used in phishing emails and matched against leaked password lists.
Hiding usernames isn’t a firewall on its own; it doesn’t replace strong passwords, login limits or 2FA. But it raises the cost of an attack and takes your site off the “easy target” list. For the bigger picture, see our guide on how to secure a WordPress site.
Where does WordPress leak usernames?
- REST API user list: yourdomain.com/wp-json/wp/v2/users returns, to anyone who isn’t logged in, a list of users who have published content along with their author slugs. The slug is often the username itself.
- ?author=N scanning: a request to yourdomain.com/?author=1 redirects to that user’s author archive and reveals the username in the address bar as /author/username/. By counting up from 1, an attacker can collect every user.
- Author archives: the /author/username/ URLs themselves; if your theme shows author links on every post, no scanning is even needed.
- Core sitemap: the wp-sitemap-users-1.xml file lists the archive URLs of every author.
- oEmbed: when one of your posts is embedded on another site, the data sent includes the author name and author URL.
- Login error messages: having different messages for “this username is not registered” and “the password is incorrect” tells an attacker which names are real. The password reset screen can reveal the same difference.
- Display name = username: if the “Display name publicly as” field in your profile matches your login name, your username is visible to everyone in post and comment bylines.
How do you test your own site?
Run these tests in a logged-out browser (a private window); what you see while logged in differs from what visitors see.
- 1. Open yourdomain.com/wp-json/wp/v2/users. If you see a list of users, you have a leak; if you see “rest_no_route” or a permissions error, it’s closed.
- 2. Open yourdomain.com/?author=1, then try 2 and 3. If the URL changes to /author/..., the username is exposed.
- 3. Open yourdomain.com/wp-sitemap-users-1.xml. If an author list comes back, you have a leak. If your SEO plugin generates its own sitemap, check its author sitemap too.
- 4. On the login page, try a username that doesn’t exist, then your real username with a wrong password. If the two error messages differ, you have a leak.
- 5. Open one of your posts and look at the author name in the byline. If it’s the same as your login username, change your display name in your profile.
How to close username leaks

- Close the REST user list to logged-out visitors. Restrict it only for logged-out requests; otherwise Gutenberg’s author picker and admin screens will break.
- Block ?author=N queries. For blogs, the most balanced approach is to stop only the numeric scanning and keep /author/slug/ archives working; sites that don’t use author archives can disable them entirely.
- Remove the author list from the core sitemap. Author archives are usually worthless to search engines anyway.
- Strip author information from oEmbed data.
- Make login error messages generic: “Incorrect username or password.” While doing so, make sure lockout warnings (“try again in X minutes”) aren’t overwritten.
- Change your display name: enter a nickname in your profile and set “Display name publicly as” to it. Your login username stays the same.
- If your admin username is something guessable like “admin” or your domain name, consider creating a new admin account, transferring your content to it and removing the old one.
You can also do these steps with code snippets added to functions.php, but each one is a separate filter and a separate maintenance burden, and they disappear when you switch themes. Also, hiding usernames doesn’t stop password attempts made through xmlrpc.php; for that, follow the steps in our post on disabling XML-RPC in WordPress as well.
What to watch for on WooCommerce stores and multi-author blogs
Base your decision on the type of site. In WooCommerce stores, customer accounts are WordPress users too, but since they don’t publish content, they don’t appear in the REST user list or author archives; the real risk lies with the administrator and shop manager accounts that publish products and blog posts. The username and display name of these accounts must always be different. If a team writes your product descriptions, give each person their own account with only the permissions they need; sharing one admin account is risky both for leaks and for accountability.
On a multi-author blog, author pages are valuable to readers and shouldn’t be closed. Here it helps to make the author slug (the part shown in the URL) different from the username; some SEO and membership plugins offer this as a setting. That way /author/ayse-yilmaz/ keeps working but doesn’t give away your login username. For corporate and single-author sites, disabling author archives entirely is the simplest solution.
Doing it all with one plugin: Hushfort Surface Hardening and Surface Scan
The Surface Hardening module in the Hushfort WordPress security plugin closes every source above from a single screen:
- REST /wp/v2/users is closed to logged-out visitors; logged-in users are exempt, so Gutenberg, WooCommerce admin and the editor are unaffected.
- Three options for author scanning: block ?author=1 scanning (author archives keep working), disable author archives entirely (404) or leave alone.
- The author list in the core sitemap and author information in oEmbed are removed.
- Login error messages are made generic; only the error codes that leak identity are generalized, and the lockout countdown stays visible.
- Blocked author scans can optionally be logged to History.
The Surface Scan in the dashboard looks at what your site actually exposes to the outside world, not at what the setting says: it sends real requests to your site, shows by name which usernames the REST user list or the ?author=1 redirect reveals, checks the sitemap author list and finds privileged accounts whose display name matches their login username. Every open finding shows up as a red card; the “Fix” link takes you straight to the relevant setting, and the “What should I do?” guide explains what the gap is used for and any side effects of the fix. Results are cached for 10 minutes and refreshed when a setting changes.
Once usernames are hidden, the remaining risk is password guessing; for login limits and lockouts, see our post on stopping brute-force attacks. If you’re having a new corporate website built, our Izmir-based team configures these settings before launch as part of our web design service.
Frequently asked questions
Does closing the REST user list break Gutenberg? Not if you restrict it only for logged-out requests. The editor runs on behalf of the logged-in user and keeps access to the list. If you have an integration that reads the user list from outside, check it separately.
Does disabling author archives hurt SEO? On single-author or corporate sites, author archives usually just duplicate the main content, and disabling them does no harm. On a multi-author blog, it’s better to keep archives open and block only ?author=N scanning.
Can I change my WordPress username? The WordPress interface locks the username. The cleanest route is to create a new admin and transfer your content to it; changing the user_login field in the database is also possible, since relationships in WordPress are tied to the user ID, not the username. Always take a backup first.
Is hiding the username enough? No. A username can always be discovered eventually; the real protection is a strong password, login limits and 2FA. Hiding usernames is an extra hurdle placed in front of those layers.
Summary: WordPress leaks usernames through the REST API, ?author=1, author archives, the sitemap, oEmbed, login errors and the display name. Close these sources to logged-out visitors only, make error messages generic, change your display name and verify the result in a private window or with a scan that measures it using real requests.