This nifty little shortcode will output the number of members in a level (or across all levels).

The output displays a message in the format: “This site has 25 Gold members”, or you can define the attribute ‘justnumber’ to output only the count of members and craft your own message like the one pictured to the right.

Shortcode Attributes

  • justnumber: Show just the count of members (optional; default: NULL)
  • level: A single level ID or comma-separated list of level IDs (optional; default: count for all levels)
  • status: A single status or comma-separated list of statuses (optional; default: ‘active’)


The Shortcode Plugin

This code recipe requires a PMPro Plus Account or higher.

View Membership Options

Comments (9)

I was going to add this to the plugin/gist for you, but it gets complicated generating the text “This site has %s members”. If you wanted to update yours to do this, you could do something like:

$levels = array_map(‘trim’, explode(‘,’, $attrs[‘level’]));

And then update

AND `membership_id` = ” . intval($attrs[‘level’]);

to be

AND `membership_id` IN(” . $levels . “)”;

Hi, Could this be used to count members who have bought access to a single page using the “Purchase Access to a Single Page or Post” Add On?

On a page, I tried something like: currently we are [pmpro_member_count justmember=true] in total

It didn’t work; somebody help!

Leave a Reply

For faster support related to issues on your specific site please open a ticket in our members support area.

Your email address will not be published. Required fields are marked *