sanitize_user


sanitize_user ( $username, $strict = false )

Parameters:
  • (string) $username The username to be sanitized.
  • (bool) $strict If set limits $username to specific characters. Default false.
Returns:
  • (string) The sanitized username, after passing through filters.
Defined at:

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.

Related Functions

sanitize_url, sanitize_term, sanitize_user_field, sanitize_key, sanitize_user_object

Top Google Results

User discussions

wpseek mobile