sanitize_user() WP 1.0
Sanitizes a username, stripping out unsafe characters.
Removes tags, octets, entities, and if strict is enabled, will only keep alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, raw username (the username in the parameter), and the value of $strict as parameters for the 'sanitize_user' filter.
Basis of: validate_username()
Hooks from the function
Return
String. The sanitized username, after passing through filters.
Usage
sanitize_user( $username, $strict );
- $username(string) (required)
- The username to be sanitized.
- $strict(true/false)
- If set limits $username to specific characters.
Default: false
Changelog
Since 2.0.0 | Introduced. |
Code of sanitize_user() sanitize user WP 5.6
Related Functions
From tag: sanitize_
- sanitize_email()
- sanitize_file_name()
- sanitize_html_class()
- sanitize_meta()
- sanitize_option()
- sanitize_post()
More from category: Other
- auth_redirect()
- count_many_users_posts()
- count_user_posts()
- count_users()
- email_exists()
- get_author_posts_url()
- get_current_user_id()
- get_editable_roles()
- get_the_author()