WordPress Hooks Explorer

Listing all hooks extracted WordPress Core


Details about users_list_table_query_args

Back to home

Files

Filename Hook Type Line Number PHP Doc
wp-admin/includes/class-wp-users-list-table.php apply_filters 137 /**
* Filters the query arguments used to retrieve users for the current users list table.
*
* @since 4.4.0
*
* @param array $args Arguments passed to WP_User_Query to retrieve items for the current
* users list table.
*/
wp-admin/includes/class-wp-ms-users-list-table.php apply_filters 93 /**
* @global string $mode List table view mode.
* @global string $usersearch
* @global string $role
*/
public function prepare_items() {
global $mode, $usersearch, $role;

if ( ! empty( $_REQUEST['mode'] ) ) {
$mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
set_user_setting( 'network_users_list_mode', $mode );
} else {
$mode = get_user_setting( 'network_users_list_mode', 'list' );
}

$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';

$users_per_page = $this->get_items_per_page( 'users_network_per_page' );

$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';

$paged = $this->get_pagenum();

$args = array(
'number' => $users_per_page,
'offset' => ( $paged - 1 ) * $users_per_page,
'search' => $usersearch,
'blog_id' => 0,
'fields' => 'all_with_meta',
);

if ( wp_is_large_network( 'users' ) ) {
$args['search'] = ltrim( $args['search'], '*' );
} elseif ( '' !== $args['search'] ) {
$args['search'] = trim( $args['search'], '*' );
$args['search'] = '*' . $args['search'] . '*';
}

if ( 'super' === $role ) {
$args['login__in'] = get_super_admins();
}

/*
* If the network is large and a search is not being performed,
* show only the latest users with no paging in order to avoid
* expensive count queries.
*/

Hook Parameters

Parameter Type Name Description
array $args Arguments passed to WP_User_Query to retrieve items for the current