You can definitely use the method @pjw303 described. We also have a feature in the Brute Force Protection settings that says “Prevent discovery of usernames through ‘/?author=N’ scans, the oEmbed API, and the WordPress REST API”.
On a WordPress system, it’s possible to discover valid usernames by visiting a specially crafted URL that looks like one of these:
- example.com/?author=2
- example.com/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fexample.com%2Fhello-world%2F
- example.com/wp-json/wp/v2/users
Enabling this option prevents hackers from being able to discover usernames using these methods. This includes finding the author in the post data provided publicly by the oEmbed API and the WordPress REST API “users” URL that was introduced in WordPress 4.7. Please note that some themes can leak usernames and we can’t prevent username discovery when a theme does this. We recommend that you keep this option enabled regardless.
Also, make sure that on your user profile page that the value for Display name publicly as is not set as what it says in the Username field. I usually try to make them completely different so it’s not easy to make an assumption of the Username would be. For example if your Display name is Anne Jenkins I can guarantee that at least one attempt (or several hundred) will be ajenkins. Also don’t use admin, the site name or domain, etc.
There are plugins that allow you to change your username since WordPress doesn’t include this functionality. They are available in the www.ads-software.com repository.
Tim