WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/sanitize user

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 sanitized username.
Default: None
$raw_username
(string) (required) The original username, prior to sanitization.
Default: None
$strict
(boolean) (optional) If set, sanitize_user() limited $username to specific ASCII characters.
Default: false

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.