Filter
rpress_ajax_found_users
On this page
Filters the users found by the admin user search before the result list is built.
Runs in the search_users AJAX handler after get_users() has run with the filtered arguments. Each remaining user is rendered as a list item showing the user login. Use it to remove users or add extra WP_User objects.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$found_users | array | Array of WP_User objects returned by get_users(). |
$search_query | string | The search term typed by the admin. |
Return value#
array. Array of WP_User objects to list.
Example#
function my_found_users( $found_users, $search_query ) {
return array_filter( $found_users, function ( $user ) {
return ! in_array( 'administrator', (array) $user->roles, true );
} );
}
add_filter( 'rpress_ajax_found_users', 'my_found_users', 10, 2 );
Source#
Applied in:
includes/class-rpress-ajax.php(line 1728), inRP_AJAX::search_users()
See also#
Was this page helpful?
