benecaster_podcast_transcripts
Filters the `podcast:transcript` entries for an episode before the RSS feed is compiled. Each entry in the returned array becomes a separate `podcast:transcript` element, pointing to a transcript file by URL, MIME type, and optional language code. An episode can reference multiple formats simultaneously.
The Transcription add-on populates this filter automatically from transcripts it has generated, but the filter fires in all installs. Append entries to add formats from an external transcription service alongside the add-on’s output, replace the array to override entirely, or return `[]` to suppress all transcript elements for the episode.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$transcripts |
array |
— | Default []. List of transcript objects {url: string, type: string, language?: string} |
$episode_id |
int |
— | ID of the episode |
Returns:
list
Examples
Add external VTT transcript from post meta
add_filter( 'benecaster_podcast_transcripts', function ( $transcripts, $episode_id ) {
$vtt_url = get_post_meta( $episode_id, '_mytranscript_vtt_url', true );
if ( $vtt_url ) {
$transcripts[] = [
'url' => $vtt_url,
'type' => 'text/vtt',
'language' => 'en',
];
}
return $transcripts;
}, 10, 2 );
Supply plain text transcript from post meta
add_filter( 'benecaster_podcast_transcripts', function ( array $transcripts, int $episode_id ): array {
$url = get_post_meta( $episode_id, '_transcript_url', true );
if ( ! $url ) {
return $transcripts;
}
$transcripts[] = [
'url' => esc_url( $url ),
'type' => 'text/plain',
'language' => 'en',
];
return $transcripts;
}, 10, 2 );
Supply multiple formats from a transcription service
add_filter( 'benecaster_podcast_transcripts', function ( array $transcripts, int $episode_id ): array {
$base_url = get_post_meta( $episode_id, '_transcript_base_url', true );
if ( ! $base_url ) {
return $transcripts;
}
$transcripts[] = [ 'url' => $base_url . '.vtt', 'type' => 'text/vtt', 'language' => 'en' ];
$transcripts[] = [ 'url' => $base_url . '.srt', 'type' => 'application/srt', 'language' => 'en' ];
$transcripts[] = [ 'url' => $base_url . '.txt', 'type' => 'text/plain', 'language' => 'en' ];
return $transcripts;
}, 10, 2 );
Notes
Supported MIME types: application/srt (SRT), text/vtt (WebVTT), text/html, text/plain, application/json. Providing multiple formats improves compatibility across podcast apps. The language key accepts an ISO 639-1 code (e.g. 'en', 'es') and is recommended for multilingual shows.