返回介绍

get_user_count()

发布于 2017-09-11 00:44:12 字数 2362 浏览 1158 评论 0 收藏 0

get_user_count( int|null $network_id = null )

The number of active users in your installation.


description

The count is cached and updated twice daily. This is not a live count.


参数

$network_id

(int|null) (Optional) ID of the network. Default is the current network.

Default value: null


返回值

(int) Number of active users on the network.


源代码

File: wp-includes/ms-functions.php

function get_user_count( $network_id = null ) {
	return get_network_option( $network_id, 'user_count' );
}

更新日志

Versiondescription
MU 2.7MU 2.7
4.8.0Introduced.

相关函数

Uses

  • wp-includes/option.php: get_network_option()

Used By

  • wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::get_views()
  • wp-admin/includes/dashboard.php: wp_network_dashboard_right_now()
  • wp-includes/update.php: wp_version_check()
  • wp-includes/ms-functions.php: wp_is_large_network()
  • wp-includes/ms-functions.php: get_sitestats()

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note Contributed by Rami Yushuvaev
    
    printf(
    	/* translators: %s: User count */
    	__( 'There are currently %s users on this site.', 'text-domain' ),
    	get_user_count()
    );
    
  2. Get number of active users

    $user_count = get_user_count();
    echo "There are currently $user_count users on this site.";
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文