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
301            * Otherwise the filter should return an array of WP_Site objects.
302            *
303            * @since 5.2.0
304            *
305            * @param array|int|null $site_data Return an array of site data to short-circuit WP's site query,
306            *                                  the site count as an integer if `$this->query_vars['count']` is set,
307            *                                  or null to run the normal queries.
308            * @param WP_Site_Query  $this      The WP_Site_Query instance, passed by reference.
309            */
310           $site_data = apply_filters_ref_array( 'sites_pre_query', array( $site_data, &$this ) );
311
312           if ( null !== $site_data ) {
313                return $site_data;
314           }
315
316           // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
317           $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
318
319           // Ignore the $fields argument as the queried result will be the same regardless.