username_exists
Filters whether the given username exists.
Использование
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(строка)
- The username to check for existence.
Список изменений
| С версии 4.9.0 | Введена. |
Где вызывается хук
username_exists
wp-includes/user.php 2079
return apply_filters( 'username_exists', $user_id, $username );