Filters the users array before the query takes place.
Description
Return a non-null value to bypass WordPress' default user queries. Filtering functions that require pagination information are encouraged to set the total_users property of the WP_User_Query object, passed to the filter by reference. If WP_User_Query does not perform a database query, it will not have enough information to generate these values itself.
Parameters
$resultsarray|null
Return an array of user data to short-circuit WP's user query or null to allow WP to run its normal queries.
814<?php815 * @since 5.1.0816 *817 * @param array|null $results Return an array of user data to short-circuit WP's user query818 * or null to allow WP to run its normal queries.819 * @param WP_User_Query $query The WP_User_Query instance (passed by reference).820 */821 $this->results = apply_filters_ref_array( 'users_pre_query', array( null, &$this ) );822823 if ( null === $this->results ) {824 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841.825 $this->request =826 "SELECT {$this->query_fields}827 {$this->query_from}
History
Introduced in 5.1.0. Unchanged from 6.7.7 through 7.1.0.