Filters a username after it has been sanitized.
Description
This filter is called before the user is created or updated.
Parameters
$sanitized_user_login
string- Username after it has been sanitized.
Source
$pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login );
Changelog
Version | Description |
---|---|
2.0.3 | Introduced. |
This filter is run before a user is created and/or updated. The fact that all pre_user hooks are run in both conditions makes life a bit more complicated.
The filter is referenced in both wp-admin/user-new.php and wp-includes/user.php
Here’s an example of using it to make sure a newly created user has a nickname equal to the user’s first and last name: