get_user_count()WP 3.0.0

Returns the number of active users in your installation.

Note that on a large site the count may be cached and only updated twice daily.

Хуков нет.

Возвращает

int. Number of active users on the network.

Использование

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

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

С версии 3.0.0 Введена.
С версии 4.8.0 The $network_id parameter has been added.
С версии 6.0.0 Moved to wp-includes/user.php.

Код get_user_count() WP 6.4.3

function get_user_count( $network_id = null ) {
	if ( ! is_multisite() && null !== $network_id ) {
		_doing_it_wrong(
			__FUNCTION__,
			sprintf(
				/* translators: %s: $network_id */
				__( 'Unable to pass %s if not using multisite.' ),
				'<code>$network_id</code>'
			),
			'6.0.0'
		);
	}

	return (int) get_network_option( $network_id, 'user_count', -1 );
}