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 sanitize_user filter.
<?php sanitize_user( $username, $strict ) ?>
wp-includes/functions-formatting.php
$strict
parameter and sanitize_user filter added in 2.0.1wp-includes/formatting.php
in 2.1sanitize_user()
is located in wp-includes/formatting.php
.
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. Others include: