wp_maybe_update_network_site_counts

Update the count of sites for the current network.

Description

wp_maybe_update_network_site_counts(); 

If enabled through the filter, update the sites count on a network when a site is created or its status is updated.


Usage

  1. if ( !function_exists( 'wp_maybe_update_network_site_counts' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_maybe_update_network_site_counts(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-functions.php  
  1. function wp_maybe_update_network_site_counts() { 
  2. $is_small_network = ! wp_is_large_network( 'sites' ); 
  3.  
  4. /** 
  5. * Filters whether to update network site or user counts when a new site is created. 
  6. * @since 3.7.0 
  7. * @param bool $small_network Whether the network is considered small. 
  8. * @param string $context Context. Either 'users' or 'sites'. 
  9. */ 
  10. if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) ) 
  11. return; 
  12.