Restrict Content Pro
rcp_get_subscription_member_count()
Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.
Note: This content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro
Returns how many memberships exist on a membership level for a given status. Counts are cached in membership level meta and refreshed when empty.
For status active or free, RCP separates paid active members from free active members (amount-based). Other statuses use rcp_count_memberships() with object_id and status. Filter: rcp_get_subscription_member_count.
Parameters
$id (int) – Membership level ID.
$status (string) – Membership status slug. Default: active. Use free for active free memberships.
Return values
(int) – Member count (minimum 0).
Examples
$paid_active = rcp_get_subscription_member_count( 3, 'active' );
$free_active = rcp_get_subscription_member_count( 3, 'free' );
$expired = rcp_get_subscription_member_count( 3, 'expired' );
$total_on_level = rcp_count_memberships(
array(
'object_id' => 3,
'status' => 'active',
)
);