Stop WordPress listing author archive URLs, and with them your usernames, in its built-in XML sitemap.
add_filter( 'wp_sitemaps_add_provider', function ( $provider, string $name ) {
return 'users' === $name ? false : $provider;
}, 10, 2 );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
WordPress’s built-in sitemap at /wp-sitemap.xml includes a list of every author’s archive URL. On most sites those pages have little value for search, and the URLs reveal usernames. This snippet removes the users sitemap.
Core sitemaps are built from providers: posts, taxonomies and users. wp_sitemaps_add_provider runs as each one is registered. Returning false for users removes it from the sitemap index and makes /wp-sitemap-users-1.xml return a 404.
Open yoursite.com/wp-sitemap.xml. There should be no users sitemap in the list.