Codex tools: Log in
Contents |
Sanitize username stripping out unsafe characters.
If $strict is true, only alphanumeric characters plus these: _, space, ., -, *, and @ are returned.
Removes tags, octets, entities, and if strict is enabled, will remove all non-ASCII characters. After sanitizing, it passes the username, raw username (the username in the parameter), and the strict parameter as parameters for the filter.
<?php sanitize_user( $username, $strict ) ?>
Since: 2.0.0
sanitize_user() is located in wp-includes/formatting.php#L758.
sanitize_user() is in a class of functions that help you sanitize potentially unsafe data which allow you to pass an arbitrary variable and receive the clean version based on data type.