get_user_count

函数


get_user_count ( $network_id = null )
参数
  • (int|null)
    $network_id
    ID of the network. Defaults to the current network.
    Required:
    Default: null
返回值
  • (int) Number of active users on the network.
定义位置
  • wp-includes/user.php
    , line 1336
引入
弃用

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.

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.' ),
				'$network_id'
			),
			'6.0.0'
		);
	}

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