benecaster_broadcast_audience_user_ids
Filters the resolved list of WordPress user IDs a broadcast will be sent to, after the audience selection has been expanded into concrete recipients. Use it to apply targeting the built-in audiences do not express — excluding a segment, restricting a send to a test group, or defining an audience slug of your own.
Built-in audiences, all populated before the filter fires:
paying— paying subscribers only. Excludes followers and bridge members on a free tier.followers— direct followers only.all— every active token holder for the show.tier:SLUG— active token holders on one specific tier, e.g.tier:gold.
tier:SLUG resolves natively — do not write a callback for it. Pass the audience string directly; a hand-rolled tier: callback shadows core’s own resolution.
The slug must match a configured benecaster_tier_map slug exactly, and matching is case-sensitive. tier:Gold does not find gold. An unconfigured slug resolves to an empty list rather than erroring, which is the same behaviour as any other unknown audience — so a typo sends to nobody and looks like a show with no subscribers on that tier.
tier:follower resolves empty by design, and that is not the bug it looks like. Follower tokens carry the tier slug follower, which is not a tier-map row on a normal install. Use the followers audience to reach them.
An unknown slug arrives as an empty array, so a callback can define a custom audience completely rather than filtering something core guessed at.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_ids |
array |
— | Resolved WordPress user IDs for the broadcast. Empty for an audience slug core does not know. |
$audience |
string |
— | Audience selection: `paying`, `followers`, `all`, `tier:SLUG`, or a custom slug. |
$show_id |
int |
— | Show post ID the broadcast belongs to. |
Returns:
array
Examples
Restrict a broadcast to a test group
add_filter( 'benecaster_broadcast_audience_user_ids', function ( array $user_ids ): array {
return array_intersect( $user_ids, [ 12, 34, 56 ] );
} );
Define a custom audience slug
add_filter( 'benecaster_broadcast_audience_user_ids', function ( array $user_ids, string $audience, int $show_id ): array {
// Only handle our own slug — everything else passes through untouched.
if ( 'joined-last-30-days' !== $audience ) {
return $user_ids;
}
return my_recent_joiner_ids( $show_id, 30 );
}, 10, 3 );
Notes
Unsubscribe suppression is applied separately and is not bypassed by this filter — adding a user ID here does not send to someone who has opted out of broadcast email.
Guard on $audience as the first line of every callback. A callback that rewrites the list unconditionally changes paying, followers, all and every tier: send at once, which is rarely what anyone means and is easy not to notice until a broadcast goes to the wrong people.
Re-entrancy is handled, within limits. Resolving an audience from inside a callback is safe: asking for the same audience you are currently resolving returns core's own answer instead of firing the filter again. A different audience still filters normally, so a callback for my-segment may legitimately ask for paying.