WordPress.org

Ready to get started?Download WordPress

Codex

Plugin API/Filter Reference/sanitize user

Contents

Description

sanitize_user is a filter applied to a user name after being cleaned up by the function sanitize_user().

Usage

function my_sanitize_user($user, $raw_user, $strict) {
    # ...
}
add_filter('sanitize_user', 'my_sanitize_user', 10, 3);

Parameters

$username
(string) (required) The username to be sanitized.
Default: None
$username
(string) (required) The original username, unaltered by sanitize_user().
Default: None
$strict
(boolean) (optional) If set, sanitize_user() limited $username to specific ASCII characters.
Default: None

Examples

Require user names be lower-cased:

add_filter('sanitize_user', 'strtolower');

Change Log

Source Files

This filter is applied by:

Related

Functions

Filters

See also index of Function Reference and index of Template Tags.
This page is marked as incomplete. You can help Codex by expanding it.