Skip to main content

benecaster_subscriber_engagement_threshold

Filter Free Since v1.0.0

Filters the number of days without a feed poll before a subscriber is considered inactive for a given show. When a token’s last feed access falls outside this window, [benecaster_subscriber_feed_inactive](/hooks/benecaster_subscriber_feed_inactive/) fires and the subscriber’s engagement status transitions to `’at_risk’`. This filter fires once per show during the daily engagement cron scan, allowing different thresholds on the same site.

The base value comes from the site-wide setting in Settings → Subscribers → Feed inactivity threshold (default 30 days). Returning a per-show override avoids false positives on lower-frequency shows — a monthly show has a naturally longer listening cadence than a weekly one. Subscribers whose token has never been accessed are excluded from threshold evaluation entirely. Practical baselines: weekly show → 30 days; bi-weekly → 45 days; monthly → 60–75 days.

Parameters

Name Type Default Description
$days int Inactivity threshold in days; default from site settings (typically 30)
$show_id int ID of the show

Returns: int

Examples

Extended threshold for monthly show

add_filter( 'benecaster_subscriber_engagement_threshold', function( $days, $show_id ) {
    // Give monthly shows a 90-day inactivity window instead of the default 30.
    $frequency = get_post_meta( $show_id, '_show_release_frequency', true );
    if ( 'monthly' === $frequency ) {
        return 90;
    }
    return $days;
}, 10, 2 );

Per-show threshold stored in post meta

add_filter( 'benecaster_subscriber_engagement_threshold', function ( int $days, int $show_id ): int {
    $custom = (int) get_post_meta( $show_id, '_my_addon_engagement_threshold', true );
    return $custom > 0 ? $custom : $days;
}, 10, 2 );

Notes

Subscribers whose token has never been accessed (last_accessed_at is null) are excluded from threshold evaluation — they are not flagged as inactive. Tokens that cross the threshold transition engagement_status from 'active' to 'at_risk' and fire benecaster_subscriber_feed_inactive.