benecaster_show_episode_transcript
Controls whether the episode page shows its “Read the transcript” link to the current visitor. The link goes to the episode’s transcript file, the same one published in the feed’s podcast:transcript tag; the page does not display the transcript text. There is no setting for it. $show_transcript starts at whether the episode has a transcript URL AND the visitor can access the episode. The filter always fires, so a callback sees the default either way.
The filter can only hide the link, exactly as benecaster_show_episode_download does. Returning true for a visitor who cannot access the episode, or for an episode with no transcript, shows nothing. A preview clip that opens the player does not open the transcript link. The file sits at your host, so a copied URL is not itself protected.
The link renders in the episode/transcript template part, which a theme can override (see Template Overrides). A theme that overrides single.php must call \Benecaster\Episode\EpisodePageLinkGate::shows_transcript() itself before including the part.
Make the transcript link a buy-up perk
The episode page shows “Read the transcript” to everyone who can access the episode. To keep it for holders of a “Transcripts” buy-up, narrow the link with benecaster_user_has_buyup().
This hides the website link only. The same URL is still in <podcast:transcript> in every feed that carries the episode, so a subscriber’s podcast app still shows the transcript. Use benecaster_user_has_buyup(), never a tier-shaped check: a buy-up’s token_type passed to a tier API fails closed for exactly the buyers.
<?php
add_filter( 'benecaster_show_episode_transcript', function ( bool $show, int $episode_id, ?int $user_id ): bool {
$my_transcripts_buyup_id = 12; // Memberships → Buy-ups → your "Transcripts" buy-up.
return $show && $user_id && benecaster_user_has_buyup( $user_id, $my_transcripts_buyup_id, (int) wp_get_post_parent_id( $episode_id ) );
}, 10, 3 );
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$show_transcript |
bool |
— | Whether Benecaster would show the link (a transcript URL is set and the visitor can access the episode) |
$episode_id |
int |
— | ID of the episode |
$user_id |
int|null |
— | WordPress user ID; null if not logged in |
$user_tier |
string|null |
— | Current tier slug; null if user has no active tier |
Returns:
bool
Example
// Hide the transcript link from visitors who are not logged in.
add_filter( 'benecaster_show_episode_transcript', function ( bool $show, int $episode_id, ?int $user_id, ?string $user_tier ): bool {
return $show && null !== $user_id;
}, 10, 4 );
Notes
Free. The filter fires in the free product's episode template, beside its free siblings.
Need this built rather than just documented? See our services →