wip
This commit is contained in:
@@ -399,10 +399,13 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||
$total_users = $query->get_total();
|
||||
|
||||
if ( $total_users < 1 ) {
|
||||
// Out-of-bounds, run the query again without LIMIT for total count.
|
||||
// Out-of-bounds, run the query without pagination/offset to get the total count.
|
||||
unset( $prepared_args['number'], $prepared_args['offset'] );
|
||||
$count_query = new WP_User_Query( $prepared_args );
|
||||
$total_users = $count_query->get_total();
|
||||
|
||||
$prepared_args['number'] = 1;
|
||||
$prepared_args['fields'] = 'ID';
|
||||
$count_query = new WP_User_Query( $prepared_args );
|
||||
$total_users = $count_query->get_total();
|
||||
}
|
||||
|
||||
$response->header( 'X-WP-Total', (int) $total_users );
|
||||
|
||||
Reference in New Issue
Block a user