sanitize_user

FILTER wp-includes\formatting.php (ligne 2045) github
Replace all whitespace characters with a basic space (U+0020). The “Zs” in the pattern selects characters in the `Space_Separator` category, which is what Unicode considers space characters.
traduction française
Remplacer tous les caractères d'espacement par un espace de base (U+0020). Les "Z" du motif sélectionnent les caractères de la catégorie `Space_Separator`, qui sont considérés par Unicode comme des caractères d'espacement.

Paramètres

Entrée :
$username, $strict = false
Sortie :
@param string[] $special_chars Array of characters to remove.
@param string   $filename_raw  The original filename to be sanitized.
@param string $filename     Sanitized filename.
@param string $filename_raw The filename prior to sanitization.
@param string $username The username to be sanitized.
@param bool   $strict   Optional. If set to true, limits $username to specific characters.
@return string The sanitized username, after passing through filters.

Utilisation

Nettoyer un nom d'utilisateur

Filtre pour nettoyer les usernames.

security
add_filter('sanitize_user', 'custom_user_sanitize');
function custom_user_sanitize($username, $raw_username, $strict) {
    return strtolower(trim($username));
}

Actualités

Chargement des actualités...