Prefix user login_name and validate it is unique on Registration
The usual way to create a user goes with the register_new_user function. This function offers no filter for the user name. It just checks for uniqueness with username_exists. To actually create the user register_new_user then calls wp_create_user, which in turn calls wp_insert_user. The latter function contains the pre_user_login filter. Then it calls username_exists again, because … Read more