Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: networks_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
205            * Return a non-null value to bypass WordPress's default site queries.
206            *
207            *
208            * @since 5.2.0
209            *
210            * @param array|null       $site_ids Return an array of site data to short-circuit WP's site query,
211            *                                   or null to allow WP to run its normal queries.
212            * @param WP_Network_Query $this     The WP_Network_Query instance, passed by reference.
213            */
214           $network_ids = apply_filters_ref_array( 'networks_pre_query', array( $network_ids, &$this ) );
215
216           if ( null === $network_ids ) {
217
218                // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
219                $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
220
221                // Ignore the $fields argument as the queried result will be the same regardless.
222                unset( $_args['fields'] );
223