WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 2103 | } |
| 2104 | |
| 2105 | /** |
| 2106 | * Filters the list of disallowed usernames. |
| 2107 | * |
| 2108 | * @since 4.4.0 |
| 2109 | * |
| 2110 | * @param array $usernames Array of disallowed usernames. |
| 2111 | */ |
| 2112 | $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
| 2113 | |
| 2114 | if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
| 2115 | return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) ); |
| 2116 | } |
| 2117 | |
| 2118 | /* |
| 2119 | * If a nicename is provided, remove unsafe user characters before using it. |
| 2120 | * Otherwise build a nicename from the user_login. |
| 2121 | */ |
| Line | Code |
| 3301 | $errors->add( 'empty_username', __( '<strong>Error</strong>: Please enter a username.' ) ); |
| 3302 | } elseif ( ! validate_username( $user_login ) ) { |
| 3303 | $errors->add( 'invalid_username', __( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); |
| 3304 | $sanitized_user_login = ''; |
| 3305 | } elseif ( username_exists( $sanitized_user_login ) ) { |
| 3306 | $errors->add( 'username_exists', __( '<strong>Error</strong>: This username is already registered. Please choose another one.' ) ); |
| 3307 | |
| 3308 | } else { |
| 3309 | /** This filter is documented in wp-includes/user.php */ |
| 3310 | $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
| 3311 | if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) { |
| 3312 | $errors->add( 'invalid_username', __( '<strong>Error</strong>: Sorry, that username is not allowed.' ) ); |
| 3313 | } |
| 3314 | } |
| 3315 | |
| 3316 | // Check the email address. |
| 3317 | if ( '' === $user_email ) { |
| 3318 | $errors->add( 'empty_email', __( '<strong>Error</strong>: Please type your email address.' ) ); |
| 3319 | } elseif ( ! is_email( $user_email ) ) { |