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 |
|---|---|
| 1418 | } |
| 1419 | |
| 1420 | /** |
| 1421 | * Filter the list of blacklisted usernames. |
| 1422 | * |
| 1423 | * @since 4.4.0 |
| 1424 | * |
| 1425 | * @param array $usernames Array of blacklisted usernames. |
| 1426 | */ |
| 1427 | $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
| 1428 | |
| 1429 | if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { |
| 1430 | return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) ); |
| 1431 | } |
| 1432 | |
| 1433 | /* |
| 1434 | * If a nicename is provided, remove unsafe user characters before using it. |
| 1435 | * Otherwise build a nicename from the user_login. |
| 1436 | */ |
| Line | Code |
| 2227 | $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) ); |
| 2228 | } elseif ( ! validate_username( $user_login ) ) { |
| 2229 | $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); |
| 2230 | $sanitized_user_login = ''; |
| 2231 | } elseif ( username_exists( $sanitized_user_login ) ) { |
| 2232 | $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ) ); |
| 2233 | |
| 2234 | } else { |
| 2235 | /** This filter is documented in wp-includes/user.php */ |
| 2236 | $illegal_user_logins = array_map( 'strtolower', (array) apply_filters( 'illegal_user_logins', array() ) ); |
| 2237 | if ( in_array( strtolower( $sanitized_user_login ), $illegal_user_logins ) ) { |
| 2238 | $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) ); |
| 2239 | } |
| 2240 | } |
| 2241 | |
| 2242 | // Check the email address |
| 2243 | if ( $user_email == '' ) { |
| 2244 | $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your email address.' ) ); |
| 2245 | } elseif ( ! is_email( $user_email ) ) { |