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
2528       * Filters whether to update network site or user counts when a new site is created.
2529       *
2530       * @since 3.7.0
2531       *
2532       * @see wp_is_large_network()
2533       *
2534       * @param bool   $small_network Whether the network is considered small.
2535       * @param string $context       Context. Either 'users' or 'sites'.
2536       */
2537      if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) ) {
2538           return;
2539      }
2540
2541      wp_update_network_site_counts( $network_id );
2542 }
2543
2544 /**
2545  * Updates the network-wide users count.
2546  *
 
Line Code
2550  * @since 3.7.0
2551  * @since 4.8.0 The `$network_id` parameter has been added.
2552  *
2553  * @param int|null $network_id ID of the network. Default is the current network.
2554  */
2555 function wp_maybe_update_network_user_counts( $network_id = null ) {
2556      $is_small_network = ! wp_is_large_network( 'users', $network_id );
2557
2558      /** This filter is documented in wp-includes/ms-functions.php */
2559      if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) {
2560           return;
2561      }
2562
2563      wp_update_network_user_counts( $network_id );
2564 }
2565
2566 /**
2567  * Updates the network-wide site count.
2568  *