benecaster_email_editor_episode_notification_is_new
Filters whether an episode is new enough to announce, asked before its notification is recorded. True when the later of $available_at and the episode’s publish date is within the last seven days.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$is_new |
bool |
— | Whether it counts as new |
$episode_id |
int |
— | The episode |
$show_id |
int |
— | Its show |
$available_at |
int |
— | When the episode opened to the tier, as a Unix time, or 0 for a teaser |
Returns:
bool
Example
add_filter( 'benecaster_email_editor_episode_notification_is_new', function ( bool $is_new, int $episode_id, int $show_id, int $available_at ): bool {
$published = (int) strtotime( get_post_field( 'post_date_gmt', $episode_id, 'raw' ) . ' UTC' );
return max( $available_at, $published ) >= time() - 30 * DAY_IN_SECONDS;
}, 10, 4 );
Notes
Each episode and trigger is recorded once, ever, so a republish announces nothing whatever this returns. Walkthrough: Choose who hears about a new episode, and when it counts as new.
Need this built rather than just documented? See our services →