sanitize_user хук-фильтрWP 2.0.1

Filters a sanitized username string.

Использование

add_filter( 'sanitize_user', 'wp_kama_sanitize_user_filter', 10, 3 );

/**
 * Function for `sanitize_user` filter-hook.
 * 
 * @param string $username     Sanitized username.
 * @param string $raw_username The username prior to sanitization.
 * @param bool   $strict       Whether to limit the sanitization to specific characters.
 *
 * @return string
 */
function wp_kama_sanitize_user_filter( $username, $raw_username, $strict ){

	// filter...
	return $username;
}
$username(строка)
Sanitized username.
$raw_username(строка)
The username prior to sanitization.
$strict(true|false)
Whether to limit the sanitization to specific characters.

Список изменений

С версии 2.0.1 Введена.

Где вызывается хук

sanitize_user()
sanitize_user
wp-includes/formatting.php 2152
return apply_filters( 'sanitize_user', $username, $raw_username, $strict );

Где используется хук в WordPress

wp-includes/ms-default-filters.php 33
add_filter( 'sanitize_user', 'strtolower' );