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
296            * Return a non-null value to bypass WordPress's default site queries.
297            *
298            *
299            * @since 5.2.0
300            *
301            * @param array|null    $site_ids Return an array of site data to short-circuit WP's site query,
302            *                                or null to allow WP to run its normal queries.
303            * @param WP_Site_Query $this The WP_Site_Query instance, passed by reference.
304            */
305           $site_ids = apply_filters_ref_array( 'sites_pre_query', array( $site_ids, &$this ) );
306
307           if ( null === $site_ids ) {
308
309                // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
310                $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
311
312                // Ignore the $fields argument as the queried result will be the same regardless.
313                unset( $_args['fields'] );
314