Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: sites_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
332            * @since 5.2.0
333            * @since 5.6.0 The returned array of site data is assigned to the `sites` property
334            *              of the current WP_Site_Query instance.
335            *
336            * @param WP_Site[]|int[]|int|null $site_data Return an array of site data to short-circuit WP's site query,
337            *                                            the site count as an integer if `$this->query_vars['count']` is set,
338            *                                            or null to run the normal queries.
339            * @param WP_Site_Query            $query     The WP_Site_Query instance, passed by reference.
340            */
341           $site_data = apply_filters_ref_array( 'sites_pre_query', array( $site_data, &$this ) );
342
343           if ( null !== $site_data ) {
344                if ( is_array( $site_data ) && ! $this->query_vars['count'] ) {
345                     $this->sites = $site_data;
346                }
347
348                return $site_data;
349           }
350