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