Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: users_pre_query

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
761            * by reference. If WP_User_Query does not perform a database query, it will not
762            * have enough information to generate these values itself.
763            *
764            * @since 5.1.0
765            *
766            * @param array|null    $results Return an array of user data to short-circuit WP's user query
767            *                               or null to allow WP to run its normal queries.
768            * @param WP_User_Query $query   The WP_User_Query instance (passed by reference).
769            */
770           $this->results = apply_filters_ref_array( 'users_pre_query', array( null, &$this ) );
771
772           if ( null === $this->results ) {
773                $this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
774
775                if ( is_array( $qv['fields'] ) || 'all' === $qv['fields'] ) {
776                     $this->results = $wpdb->get_results( $this->request );
777                } else {
778                     $this->results = $wpdb->get_col( $this->request );
779                }