Skip to main content

benecaster_subscriber_engagement_threshold

Filter Free

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 fires and the subscriber’s engagement status transitions to 'at_risk'. The daily engagement check applies it once per show, so shows on the same site can use different thresholds.

$days arrives as the show’s own setting: the Feed inactivity threshold in Show Settings → Subscription, 1 to 365 days, default 30. That setting is where a podcaster tunes the window — a monthly show has a naturally longer listening cadence than a weekly one — so reach for this filter only when the value has to come from code. You can return a lower number as well as a higher one; the result is never treated as less than 1 day.

To display the threshold, call benecaster_get_engagement_threshold(), which returns the show’s setting with this filter applied — exactly what the daily check uses. Never keep a copy of the number yourself.

Subscribers whose token has never been accessed are excluded from threshold evaluation entirely. They are a different cohort with their own hook — benecaster_subscriber_never_accessed — because “lapsed” and “never started” call for different handling.

Parameters

Name Type Default Description
$days int — The show's Feed inactivity threshold from Show Settings, in days (default `30`)
$show_id int — ID of the show

Returns: int

Examples

Shorter threshold for a daily show

add_filter( 'benecaster_subscriber_engagement_threshold', function( $days, $show_id ) {
    // A show that releases daily: flag silence after a week, whatever the setting says.
    if ( 'daily' === get_post_meta( $show_id, '_my_addon_release_cadence', true ) ) {
        return 7;
    }
    return $days;
}, 10, 2 );

Notes

The check reads the live value on every run, so a change to the setting or to this filter takes effect at the next daily check. It runs on WP-Cron, which fires on site traffic, so on a quiet site a transition can lag by a day or more. Worked examples: the recipes Show the inactivity threshold in your add-on and Trigger a re-engagement automation when a subscriber goes silent.

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