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
210            * Otherwise the filter should return an array of WP_Network objects.
211            *
212            * @since 5.2.0
213            *
214            * @param array|null       $network_data Return an array of network data to short-circuit WP's network query,
215            *                                       the network count as an integer if `$this->query_vars['count']` is set,
216            *                                       or null to allow WP to run its normal queries.
217            * @param WP_Network_Query $this         The WP_Network_Query instance, passed by reference.
218            */
219           $network_data = apply_filters_ref_array( 'networks_pre_query', array( $network_data, &$this ) );
220
221           if ( null !== $network_data ) {
222                return $network_data;
223           }
224
225           // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
226           $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
227
228           // Ignore the $fields argument as the queried result will be the same regardless.