Choose which transcript downloads your listeners get
Under the transcript on the episode page and in [benecaster_transcript] (full and scrollable modes), visitors who may read the transcript get Download the transcript: SRT, VTT, Plain text and, where it can print them, PDF. To offer plain text only on one show, and nothing on another:
- The filter only removes: the links keep the add-on’s order, and a format the transcript does not have is ignored (a plain-text import has
txtonly). - It is asked only for a visitor
benecaster_user_can_see_transcript()lets through. Removing a link hides the address, not the file:/wp-json/benecaster-transcription/v1/transcripts/{key}.srt(or.vtt,.txt) stays public, as for every podcast app. - To link a file yourself, add
?download=1to its address to have it sent as an attachment named{episode-slug}-transcript.{ext};\BenecasterTranscription\Endpoint\TranscriptEndpoint::download_url( $public_key, TranscriptFormat::Srt, $revision )builds it, withvfrom the revision so a corrected transcript is never a cached copy. - The episode editor’s Export buttons are not affected.
Code
<?php
add_filter( 'benecaster_transcript_download_formats', function ( array $formats, int $episode_id ): array {
$show_id = (int) get_post_field( 'post_parent', $episode_id );
if ( 12 === $show_id ) {
return [ 'txt' ];
}
return 34 === $show_id ? [] : $formats;
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →