pre_user_login
Filter HookDescription
Filters a username after it has been sanitized. This filter is called before the user is created or updated.Hook Information
| File Location | wp-includes/user.phpView on GitHub | 
| Hook Type | Filter | 
| Line Number | 2233 | 
Hook Parameters
| Type | Name | Description | 
|---|---|---|
| string | $sanitized_user_login | Username after it has been sanitized. | 
Usage Examples
                        Basic Usage
                    
                    <?php
// Hook into pre_user_login
add_filter('pre_user_login', 'my_custom_filter', 10, 1);
function my_custom_filter($sanitized_user_login) {
    // Your custom filtering logic here
    return $sanitized_user_login;
}
Source Code Context
                        wp-includes/user.php:2233
                        - How this hook is used in WordPress core
                    
                    <?php
2228  	 *
2229  	 * @since 2.0.3
2230  	 *
2231  	 * @param string $sanitized_user_login Username after it has been sanitized.
2232  	 */
2233  	$pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login );
2234  
2235  	// Remove any non-printable chars from the login string to see if we have ended up with an empty username.
2236  	$user_login = trim( $pre_user_login );
2237  
2238  	// user_login must be between 0 and 60 characters.
PHP Documentation
<?php
/**
	 * Filters a username after it has been sanitized.
	 *
	 * This filter is called before the user is created or updated.
	 *
	 * @since 2.0.3
	 *
	 * @param string $sanitized_user_login Username after it has been sanitized.
	 */
                        Quick Info
                    
                    - Hook Type: Filter
- Parameters: 1
- File: wp-includes/user.php
                        Related Hooks
                    
                    Related hooks will be displayed here in future updates.
