username_exists
Filters whether the given username exists.
Usage
add_filter( 'username_exists', 'wp_kama_username_exists_filter', 10, 2 ); /** * Function for `username_exists` filter-hook. * * @param int|false $user_id The user ID associated with the username, or false if the username does not exist. * @param string $username The username to check for existence. * * @return int|false */ function wp_kama_username_exists_filter( $user_id, $username ){ // filter... return $user_id; }
- $user_id(int|false)
- The user ID associated with the username, or false if the username does not exist.
- $username(string)
- The username to check for existence.
Changelog
Since 4.9.0 | Introduced. |
Where the hook is called
username_exists
wp-includes/user.php 1953
return apply_filters( 'username_exists', $user_id, $username );