illegal_user_logins
Filter HookDescription
Check a username for the REST API. Performs a couple of checks like edit_user() in wp-admin/includes/user.php.Hook Information
| File Location |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
View on GitHub
|
| Hook Type | Filter |
| Line Number | 1324 |
Hook Parameters
| Type | Name | Description |
|---|---|---|
string
|
$value
|
The username submitted in the request. |
WP_REST_Request
|
$request
|
Full details about the request. |
string
|
$param
|
The parameter name. |
Usage Examples
Basic Usage
<?php
// Hook into illegal_user_logins
add_filter('illegal_user_logins', 'my_custom_filter', 10, 3);
function my_custom_filter($value, $request, $param) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:1324
- How this hook is used in WordPress core
<?php
1319 array( 'status' => 400 )
1320 );
1321 }
1322
1323 /** This filter is documented in wp-includes/user.php */
1324 $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
1325
1326 if ( in_array( strtolower( $username ), array_map( 'strtolower', $illegal_logins ), true ) ) {
1327 return new WP_Error(
1328 'rest_user_invalid_username',
1329 __( 'Sorry, that username is not allowed.' ),
PHP Documentation
<?php
/**
* Check a username for the REST API.
*
* Performs a couple of checks like edit_user() in wp-admin/includes/user.php.
*
* @since 4.7.0
*
* @param string $value The username submitted in the request.
* @param WP_REST_Request $request Full details about the request.
* @param string $param The parameter name.
* @return string|WP_Error The sanitized username, if valid, otherwise an error.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
Related Hooks
Related hooks will be displayed here in future updates.