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
223            * @since 5.2.0
224            * @since 5.6.0 The returned array of network data is assigned to the `networks` property
225            *              of the current WP_Network_Query instance.
226            *
227            * @param array|int|null   $network_data Return an array of network data to short-circuit WP's network query,
228            *                                       the network count as an integer if `$this->query_vars['count']` is set,
229            *                                       or null to allow WP to run its normal queries.
230            * @param WP_Network_Query $query        The WP_Network_Query instance, passed by reference.
231            */
232           $network_data = apply_filters_ref_array( 'networks_pre_query', array( $network_data, &$this ) );
233
234           if ( null !== $network_data ) {
235                if ( is_array( $network_data ) && ! $this->query_vars['count'] ) {
236                     $this->networks = $network_data;
237                }
238
239                return $network_data;
240           }
241