username_exists
Filter HookDescription
Filters whether the given username exists.Hook Information
File Location |
wp-includes/user.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2066 |
Hook Parameters
Type | Name | Description |
---|---|---|
int|false
|
$user_id
|
The user ID associated with the username, or false if the username does not exist. |
string
|
$username
|
The username to check for existence. |
Usage Examples
Basic Usage
<?php
// Hook into username_exists
add_filter('username_exists', 'my_custom_filter', 10, 2);
function my_custom_filter($user_id, $username) {
// Your custom filtering logic here
return $user_id;
}
Source Code Context
wp-includes/user.php:2066
- How this hook is used in WordPress core
<?php
2061 *
2062 * @param int|false $user_id The user ID associated with the username,
2063 * or false if the username does not exist.
2064 * @param string $username The username to check for existence.
2065 */
2066 return apply_filters( 'username_exists', $user_id, $username );
2067 }
2068
2069 /**
2070 * Determines whether the given email exists.
2071 *
PHP Documentation
<?php
/**
* Filters whether the given username exists.
*
* @since 4.9.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.