Sébastien Laframboise

Prevent enumeration of WordPress users without blocking useful features

Prevent enumeration of WordPress users without blocking useful features

User enumeration is the process of identifying public accounts or usernames associated with a WordPress site. It does not grant access to an account, but it can provide a useful list for a brute-force attack, phishing, or password reuse attempts.

To prevent WordPress user enumeration without breaking your site, start by distinguishing data that must remain public from data that’s useless to your visitors. Then limit only the affected paths and verify your integrations before deployment.

Understanding what can reveal an account

A display name in a post is not automatically a login username. WordPress separates several profile fields, including the public name and the slug. However, choosing the same name can needlessly link the public identity to the account used to administer the site.

Author archives are a primary source of information. WordPress generates archive URLs for users and may use either a numeric ID or a simplified name in those addresses. The official documentation on the WordPress template hierarchy also notes that an author archive can exist even when a user hasn’t published any content.

The users REST endpoint is another area to check. The official reference states that the users endpoint can list accounts and filter results by several parameters, including slug and authors who have published content. That can be useful for a legitimate integration, but unnecessary for a site that doesn’t present authors.

Assess the risk before blocking anything

Don’t treat all public data as a critical vulnerability. On a multi-author blog, author profiles often explain who’s writing, group posts, and build trust. In that context, fully hiding authors can degrade the reading experience.

Risk increases when the site exposes identifiers similar to login names, when accounts have high privileges, or when the login page already receives many attempts. So reduce avoidable clues while keeping unique passwords, multifactor authentication where available, and limiting login attempts.

This measure complements, rather than replaces, protection against guessed passwords. Also see this guide to protecting WordPress against brute force attacks.

Check the publicly accessible enumeration paths

Do checks in a private window while logged out of the dashboard. That way you’ll see what an anonymous visitor can actually view. Note the results before making changes so you can compare after the fix.

Examine author archives and post links

Open a few published posts and click the author name, if shown. Check whether the resulting page shows a name, slug, or biography you don’t want public. Also review links in menus, widgets, query blocks, and structured data produced by the theme or a plugin.

You can also test an address using the parameter ?author=1, then a few limited numbers. the official function get_author_posts_url() shows that WordPress can build an author URL from a numeric ID. Final behavior still depends on your permalinks, theme, and active redirects.

Inspect the REST response without modifying it

Then test the path /wp-json/wp/v2/users?per_page=100&_fields=id,slug,name,link in a private browser window. The parameter _fields deliberately limits the response to the requested fields; how it works is described in the global parameters documentation for the REST API.

Record three possible outcomes: no data returned, only published authors visible, or multiple profiles appearing. Do not try to deduce a password or flood the site with requests. The goal is only to determine what your site already makes public.

Choose targeted protection

The best fix depends on actual use of authors and the API. Avoid a blanket disabling done blindly. It can remove a useful editorial feature or break an app that uses the API with authentication.

Case 1: your site does not need public author profiles

If only one person publishes and author archives add nothing, ask your developer, security plugin, or host to block or redirect public author archive requests. The rule should target both author URLs and attempts using the author.

parameter. However, keep the content pages themselves. It’s not necessary to remove the company name, byline, or an «About» page if those help your visitors. The goal is to avoid technical exposure of an account, not to anonymize your content.

Case 2: your authors must remain visible

When author archives have editorial value, keep them but clearly dissociate the public name from the login name. Each person should use a distinct administration identifier that’s hard to guess and never displayed in posts.

Also review accounts that no longer publish. An old access usually doesn’t need to be associated with a public profile. Follow a clear method to manage inactive WordPress accounts and former access, and then remove permissions that are no longer needed.

Case 3: an integration uses the REST API

Do not automatically block the entire REST API. Publishers, plugins, and external services may rely on certain endpoints. Instead request a precise restriction of the public endpoint that lists users, while preserving authenticated requests needed by your tools.

Before launch, list forms, mobile apps, automation tools, editing plugins, and external connections. If a service needs API access, prefer limited access via a dedicated account. The WordPress application passwords specifically allow an integration without sharing a user’s primary password.

Deploy without breaking the site

First make the change in a test environment when your host provides one. Otherwise create a recent backup and document the rule applied, where it’s located, and the person responsible. That way you can quickly roll back if an integration stops working.

After the adjustment, repeat the same anonymous checks. Confirm that author archives respond according to your decision, that the REST endpoint no longer discloses unnecessary profiles, and that legitimate posts, forms, and logins still work.

  • Test the author links displayed on multiple posts.
  • Check the public response of the users REST path.
  • Log in with a limited-rights account and an administrator account.
  • Test the functions of any integration that uses the API.
  • Review security logs and server errors after deployment.

Finally, monitor login attempts and blocked requests for a few days. An increase in automated requests can confirm the rule’s effectiveness, while a recurring failure from a known service indicates a targeted adjustment is still needed.

The most sustainable measure

Preventing WordPress user enumeration reduces the information available to an attacker, but never replaces rigorous account management. Use non-public administrator credentials, limit privileges, remove obsolete access, and protect the login.

Selective protection is generally the best approach: keep visible the authors who actually serve your readers, then limit technical mechanisms that reveal accounts without concrete benefit. This preserves useful site functions while reducing its attack surface.