benecaster_count_paying_subscribers()
benecaster_count_paying_subscribers( int $show_id ): int
Counts paying subscribers for one show. This is the function to reach for whenever the question is about money or plan limits.
“Paying” means two things at once: the token’s type is not one Benecaster exempts from paying (TokenRepository::PAYING_EXEMPT_TOKEN_TYPES: follower and purchaser), and its tier is not a free tier according to whichever tier table the show uses (benecaster_tier_map for a bridge show, benecaster_membership_tiers for a built-in-membership show; a tier in neither counts as paying). Both filters are required, and applying only one miscounts. The first excludes direct followers, who hold no bridge membership — but it is a deny list, not an allow list of the subscriber type: any other token type counts, including one an add-on defines that Benecaster has never heard of, and the exempt list can grow (it already has: purchaser). The second excludes members sitting on a $0 tier, who do carry a subscriber token. A hand-rolled count that filters on token_type = 'subscriber' instead of the exempt-type deny list under-counts, silently — a custom or add-on-defined token type on a paid tier is real paying capacity it will miss.
Manual grants are counted. A comped subscriber on a paid tier consumes real capacity, so they belong in the figure.
This is a different number from benecaster_get_subscriber_count(), which counts every active token including followers and free-tier members. The two disagreeing is the correct outcome, not a bug — they answer different questions, and on a show with a large free following they differ by a wide margin.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
show_id |
int |
— | Yes | WordPress post ID of the show. |
Return Value
Type:
int
Paying subscriber count for the show, zero when none.
Example
$paying = benecaster_count_paying_subscribers( $show_id );
$audience = benecaster_get_subscriber_count( $show_id );
printf( '%d paying of %d listeners', $paying, $audience );
Notes
There is deliberately no filter on the return value. This is the number the plan's paying-subscriber threshold is about, and a filter here would invite integrations to "adjust" a figure whose only useful property is that it says what is actually in the database. If you want to change a displayed audience figure, that is benecaster_analytics_subscriber_count on the other function.
See Which subscriber count is the paying one for what the distinction costs in practice.
Need this built rather than just documented? See our services →