Skip to main content

benecaster_email_editor_episode_notification_recipients

Filter Premium email-editor

Filters who is told about an episode, once, as its notification starts sending from cron. Before the filter: a teaser reaches the all audience; unlock:public the followers audience; unlock:SLUG the buy-up’s holders when SLUG is a buy-up, otherwise the tier:SLUG audience. A listener the episode already has, from another of its notifications, is left out after the filter, so nobody hears twice about one episode.

Parameters

Name Type Default Description
$user_ids array — WordPress user ids
$episode_id int — The episode
$show_id int — Its show
$trigger_key string — `teaser`, or `unlock:` and the slug Benecaster unlocked

Returns: array

Example

add_filter( 'benecaster_email_editor_episode_notification_recipients', function ( array $user_ids, int $episode_id, int $show_id, string $trigger_key ): array {
    return array_values( array_filter( $user_ids, fn( int $id ): bool => ! user_can( $id, 'edit_posts' ) ) );
}, 10, 4 );

Notes

Each listener is still sent through benecaster_send_email(), so an opt-out is honored and Benecaster's benecaster_email_should_send_episode_notification (the per-type variant of benecaster_email_should_send) can suppress one at send time. Walkthrough: Choose who hears about a new episode, and when it counts as new.

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