benecaster_locked_content_message
Filters the message displayed when content is locked. Use to create custom upgrade prompts — for example, free tier subscribers see ‘Subscribe to listen’ while lower paid tiers see ‘Upgrade to Premium for early access.’
Return an HTML string. Cast with (string) at both call sites.
The third parameter is always an empty string. Both call sites pass a hardcoded '', so it carries no information — do not branch on it. The useful arguments are $episode_id, $user_tier (4th) and $show_id (5th).
$user_tier is '' both when logged out and when logged in without a subscription. These are different situations and this filter cannot distinguish them on its own; check is_user_logged_in() if the message should differ.
Fires from [benecaster_player] and from templates/episode/player-locked.php with identical arguments. Returning '' renders nothing in place of the player.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$message |
string |
— | Locked content message HTML |
$episode_id |
int |
— | ID of the episode |
$required_tier |
string |
— | Tier slug required to access the content |
$user_tier |
string|null |
— | Current user's tier slug; null if not subscribed |
$show_id |
int |
— | ID of the show the episode belongs to. Matches the shared signature of `benecaster_episode_item_output`. Existing 4-arg listeners keep working — PHP silently ignores the extra argument. |
Returns:
string
Example
add_filter( 'benecaster_locked_content_message', function( string $message, int $episode_id, string $required_tier, ?string $user_tier, int $show_id ): string {
// Show a tier-specific upgrade prompt.
if ( 'follower' === $user_tier && 'premium' === $required_tier ) {
return '<p>Upgrade to Premium to unlock early access and bonus episodes.</p>';
}
if ( null === $user_tier ) {
return '<p>Subscribe to listen to this episode.</p>';
}
return $message;
}, 10, 5 );
Need this built rather than just documented? See our services →