get_var("select count(id) from $wpdb->users");" That’s it."/> get_var("select count(id) from $wpdb->users");" That’s it.">

Home >CMS Tutorial >WordPress >How to get the number of registered wordpress users

How to get the number of registered wordpress users

藏色散人
藏色散人Original
2019-12-26 10:16:212772browse

How to get the number of registered wordpress users

#How to get the number of registered wordpress users?

The example in this article describes the method of obtaining the number of WordPress registered users and shares it with everyone for your reference. The specific implementation method is as follows:

Recommended: "wordpress tutorial"

Method 1, the code is as follows:

The code is as follows:

global $wpdb 
$users = $wpdb->get_var("select count(id) from $wpdb->users"); 
echo "总共有 ".$users." 位注册用户";

Method 2, the code is as follows:

The code is as follows:

$users=wp_list_authors('echo=0&exclude_admin=0&hide_empty=0&optioncount=1&style=0'); 
$users=split(',',$users); 
echo '本站有', count($users), '位注册用户'; ?>

I hope this article will be helpful to everyone in building a WordPress website.

For more WordPress related technical articles, please visit the WordPress tutorial column: https://www.php.cn/cms/wordpress/

The above is the detailed content of How to get the number of registered wordpress users. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn