benecaster_teaser_content
Filters the teaser content shown to non-subscribers in place of the full episode content.
Return an HTML string, or '' for no teaser. Cast with (string).
'' is a meaningful value on both sides: it arrives when no teaser was resolved, and returning it suppresses the teaser entirely.
The third parameter, $source, says which strategy produced the incoming value — description, word_count, custom, or '' when there is none — so a callback can refine core’s result without recomputing it, or replace only the auto-truncated (word_count) case while leaving a hand-written custom teaser alone. Word-count teasers arrive tag-stripped and with no ellipsis when the content was already at or below the limit.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$teaser |
string |
— | Teaser content HTML |
$episode_id |
int |
— | ID of the episode |
$user_tier |
string|null |
— | Current user's tier slug; null if not subscribed |
Returns:
string
Example
add_filter( 'benecaster_teaser_content', function( $teaser, $episode_id, $user_tier ) {
// Replace the default teaser with the episode excerpt for non-subscribers.
if ( null === $user_tier ) {
$excerpt = get_post_field( 'post_excerpt', $episode_id );
if ( $excerpt ) {
return '<p>' . esc_html( $excerpt ) . '</p>';
}
}
return $teaser;
}, 10, 3 );
Need this built rather than just documented? See our services →