{"id":41727,"date":"2025-10-25T16:18:28","date_gmt":"2025-10-25T13:18:28","guid":{"rendered":"https:\/\/coma.lv\/2025\/10\/25\/how-to-show-the-number-of-registered-users-on-your-site\/"},"modified":"2025-10-25T16:18:28","modified_gmt":"2025-10-25T13:18:28","slug":"how-to-show-the-number-of-registered-users-on-your-site","status":"publish","type":"post","link":"https:\/\/coma.lv\/en\/2025\/10\/25\/how-to-show-the-number-of-registered-users-on-your-site\/","title":{"rendered":"How to Show the Number of Registered Users on Your Site"},"content":{"rendered":"\n<p style=\"text-align: left;\">Have you ever wanted to show how many people have decided to register on your site? This kind of information works great as social proof and often encourages new visitors to join. In this article you will learn how to display the number of registered users in WordPress in two simple ways.<\/p>\n<h2 style=\"text-align: left;\">Method 1. Show the Number of Registered Users with a Plugin<\/h2>\n<p style=\"text-align: left;\">First you need to install and activate <a href=\"https:\/\/wordpress.org\/plugins\/simple-blog-stats\/\" target=\"_blank\" rel=\"noopener\">Simple Blog Stats<\/a>. If you have not installed plugins before, we advise you to take a look at our step-by-step guide on <a href=\"https:\/\/coma.lv\/en\/2024\/08\/21\/how-to-install-a-plugin-in-wordpress-a-step-by-step-guide-for-beginners\/\" target=\"_blank\" rel=\"noopener\">how to install a plugin in WordPress<\/a>. After activation, go to <strong>Settings &gt; Simple Blog Stats<\/strong>.<\/p>\n<p style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-36954 size-full\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081043.jpg\" alt=\"WordPress\" width=\"830\" height=\"597\" title=\"\" srcset=\"https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081043.jpg 830w, https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081043-300x216.jpg 300w, https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081043-768x552.jpg 768w, https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081043-705x507.jpg 705w\" sizes=\"auto, (max-width: 830px) 100vw, 830px\" \/><\/p>\n<p style=\"text-align: left;\">This plugin lets you show various statistics about your site. Open the shortcodes tab, scroll down to <strong data-start=\"1240\" data-end=\"1259\">number of users<\/strong> \u2014 there you will see the shortcode:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\" style=\"text-align: left;\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">[<span class=\"hljs-meta\">sbs_users<\/span>]<\/code><\/div>\n<\/div>\n<p style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-36955 size-full\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081301.jpg\" alt=\"WordPress\" width=\"968\" height=\"297\" title=\"\" srcset=\"https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081301.jpg 968w, https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081301-300x92.jpg 300w, https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081301-768x236.jpg 768w, https:\/\/coma.lv\/wp-content\/uploads\/2025\/11\/Ekranuznemums-2025-11-23-081301-705x216.jpg 705w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/p>\n<p style=\"text-align: left;\" data-start=\"1308\" data-end=\"1455\">On either side of the shortcode there are two text fields \u2014 HTML before and after the user count output. By default the result will look, for example, like this:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\" style=\"text-align: left;\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">span<\/span><\/span><\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"sbs-count-users\"<\/span>&gt;856<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">span<\/span><\/span>&gt;<\/code><\/div>\n<\/div>\n<p style=\"text-align: left;\">Just copy the shortcode and click the save button. Now you can use it in any post, page or widget. If the shortcode does not work in your sidebar, take a look at our guide on how to properly enable shortcode support in widgets.<\/p>\n<h2 style=\"text-align: left;\">Method 2. Show the Number of Registered Users Manually with Code<\/h2>\n<p style=\"text-align: left;\">If you prefer your own solution or want minimal code without third-party plugins, you can use a shortcode with optimized code that includes caching and built-in HTML markup. You can add the code to your own mini-plugin or to your theme&#8217;s <code data-start=\"2527\" data-end=\"2542\">functions.php<\/code>:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ Function to get the total user count with caching\r\nfunction wpb_user_count() {\r\n    \/\/ Check if the count is cached\r\n    $cached_count = get_transient(&amp;#039;wpb_user_count&amp;#039;);\r\n    if ($cached_count !== false) {\r\n        return &amp;#039;&amp;lt;span class=&amp;quot;user-count&amp;quot;&amp;gt;&amp;#039; . esc_html($cached_count) . &amp;#039;&amp;lt;\/span&amp;gt;&amp;#039;;\r\n    }\r\n\r\n    \/\/ Get the total number of users\r\n    $usercount = count_users();\r\n    $result = $usercount&#x5B;&amp;#039;total_users&amp;#039;];\r\n\r\n    \/\/ Cache the result for 1 hour to reduce database load\r\n    set_transient(&amp;#039;wpb_user_count&amp;#039;, $result, HOUR_IN_SECONDS);\r\n\r\n    \/\/ Return the result wrapped in HTML for easy styling\r\n    return &amp;#039;&amp;lt;span class=&amp;quot;user-count&amp;quot;&amp;gt;&amp;#039; . esc_html($result) . &amp;#039;&amp;lt;\/span&amp;gt;&amp;#039;;\r\n}\r\n\r\n\/\/ Register the shortcode\r\nadd_shortcode(&amp;#039;user_count&amp;#039;, &amp;#039;wpb_user_count&amp;#039;);\r\n\r\n<\/pre>\n<p style=\"text-align: left;\">This code creates the <code data-start=\"148\" data-end=\"162\">[user_count]<\/code> shortcode, which you can use in posts, on pages or inside a sidebar widget to display the number of users of your site. The number is output with the HTML class <code data-start=\"333\" data-end=\"345\">user-count<\/code>, which makes it easy to style with CSS. For example, you can add this to a theme file or to custom CSS:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n.user-count {\r\n    font-weight: bold;\r\n    color: #2a9d8f;\r\n    font-size: 1.2em;\r\n}\r\n<\/pre>\n<p style=\"text-align: left;\">You can use the shortcode directly in the text of a post or page:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\" style=\"text-align: left;\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">Join [user_count] other <span class=\"hljs-built_in\">users<\/span> <span class=\"hljs-built_in\">who<\/span> share your interests!<br \/>\n<\/code><\/div>\n<\/div>\n<p style=\"text-align: left;\">As a result, the user count will be nicely formatted according to your styles.<br \/>\nIn our case it looked like this:<\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2016\/10\/usercount-preview.jpg\" alt=\"WordPress\" title=\"\"><\/p>\n<p style=\"text-align: left;\" data-start=\"2796\" data-end=\"2971\">Additionally, you can add a registration button that leads to your custom registration page \u2014 this approach works great when you want to increase conversion.<\/p>\n<hr \/>\n<p style=\"text-align: left;\"><em>Our specialization is WordPress website development and maintenance. Contact us for a free consultation \u2014 <a href=\"mailto:vadim@coma.lv\">vadim@coma.lv<\/a>, <a href=\"tel:+37129394520\">+371 29394520<\/a><\/em><\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted to show how many people have decided to register on your site? This kind of information works great as social proof and often encourages new visitors to join. In this article you will learn how to display the number of registered users in WordPress in two simple ways. Method 1. Show [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":37144,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1225,1406],"tags":[],"class_list":["post-41727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-for-beginners"],"_links":{"self":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/comments?post=41727"}],"version-history":[{"count":0,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41727\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media\/37144"}],"wp:attachment":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media?parent=41727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/categories?post=41727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/tags?post=41727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}