Skip to main content

Override subscriber count from an external analytics source

Premium Beginner

When your source of truth for subscriber counts is external — a hosting platform, payment processor, or BI tool — override benecaster_get_subscriber_count() to return the external figure. Cache aggressively, and fall back to Benecaster’s own count on a cache miss rather than returning zero.

This does not affect your billing

Nothing you return here reaches Benecaster’s licence server, changes your plan, or moves a subscriber limit. What this filter changes is display and reporting — the figure Benecaster shows you and hands to add-ons.

Your plan limit, the free-tier threshold notices and any upgrade prompt are all decided from a separate count taken straight from the database: active paying tokens, excluding free tiers and follower signups. That count is not filterable, and it is the only figure sent to the licence server on the daily validation ping.

Code

<?php
add_filter( 'benecaster_analytics_subscriber_count', function ( int $count, int $show_id ): int {
    $external = (int) get_transient( 'my_subscriber_count_' . $show_id );
    return $external > 0 ? $external : $count; // fall back to Benecaster count on cache miss
}, 10, 2 );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →