sanitize_user
sanitize_user ( $username, $strict = false )
Parameters:- (string) username The username to be sanitized.
- (bool) strict Optional. If set limits $username to specific characters. Default false.
Returns:- (string) The sanitized username, after passing through filters.
Defined at: - Introduced in WordPress: 2.0.0
- Deprecated in WordPress: —
Description
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 {@see 'sanitize_user'} filter.