Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: enable_live_network_counts

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

This hook occurs 2 times in this file.

Line Code
2330       * Filters whether to update network site or user counts when a new site is created.
2331       *
2332       * @since 3.7.0
2333       *
2334       * @see wp_is_large_network()
2335       *
2336       * @param bool   $small_network Whether the network is considered small.
2337       * @param string $context       Context. Either 'users' or 'sites'.
2338       */
2339      if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) )
2340           return;
2341
2342      wp_update_network_site_counts( $network_id );
2343 }
2344
2345 /**
2346  * Update the network-wide users count.
2347  *
2348  * If enabled through the {@see 'enable_live_network_counts'} filter, update the users count
 
Line Code
2351  * @since 3.7.0
2352  * @since 4.8.0 The $network_id parameter has been added.
2353  *
2354  * @param int|null $network_id ID of the network. Default is the current network.
2355  */
2356 function wp_maybe_update_network_user_counts( $network_id = null ) {
2357      $is_small_network = ! wp_is_large_network( 'users', $network_id );
2358
2359      /** This filter is documented in wp-includes/ms-functions.php */
2360      if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) )
2361           return;
2362
2363      wp_update_network_user_counts( $network_id );
2364 }
2365
2366 /**
2367  * Update the network-wide site count.
2368  *
2369  * @since 3.7.0