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.
定義位置
相關方法
get_user_optionget_user_metaget_user_bywp_is_large_user_countget_comment_count
引入
-
棄用
-

get_user_count: 這是一個WordPress函式,用於返回WordPress安裝中的註冊使用者總數: 該函式不需要引數,返回一個代表使用者數量的整數。

返回你的安裝中的活躍使用者數。

請注意,在一個大的網站上,計數可能被快取,每天只更新兩次。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 );
}
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 ); }
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 );
}

常見問題

FAQs
檢視更多 >