sanitize_user
Filter HookDescription
Filters a sanitized username string.Hook Information
File Location |
wp-includes/formatting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2166 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$username
|
Sanitized username. |
string
|
$raw_username
|
The username prior to sanitization. |
bool
|
$strict
|
Whether to limit the sanitization to specific characters. |
Usage Examples
Basic Usage
<?php
// Hook into sanitize_user
add_filter('sanitize_user', 'my_custom_filter', 10, 3);
function my_custom_filter($username, $raw_username, $strict) {
// Your custom filtering logic here
return $username;
}
Source Code Context
wp-includes/formatting.php:2166
- How this hook is used in WordPress core
<?php
2161 *
2162 * @param string $username Sanitized username.
2163 * @param string $raw_username The username prior to sanitization.
2164 * @param bool $strict Whether to limit the sanitization to specific characters.
2165 */
2166 return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
2167 }
2168
2169 /**
2170 * Sanitizes a string key.
2171 *
PHP Documentation
<?php
/**
* Filters a sanitized username string.
*
* @since 2.0.1
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/formatting.php
Related Hooks
Related hooks will be displayed here in future updates.