wp_update_network_user_counts()WP 3.7.0

Update the network-wide user count.

Хуков нет.


null. Ничего.


wp_update_network_user_counts( $network_id );
ID of the network.
По умолчанию: current network


  • Global. wpdb. $wpdb WordPress database abstraction object.

Список изменений

С версии 3.7.0 Введена.
С версии 4.8.0 The $network_id parameter has been added.

Код wp_update_network_user_counts() WP 5.9.3

function wp_update_network_user_counts( $network_id = null ) {
	global $wpdb;

	$count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
	update_network_option( $network_id, 'user_count', $count );