Skip to main content

benecaster_show_episode_transcript

Filter Free

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. It starts false when the URL belongs to an add-on that is not loaded (see Keep a restricted transcript private when your add-on is switched off). 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.

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 →