Skip to main content

benecaster_transcription_status()

Episode Premium transcription
benecaster_transcription_status( int $episode_id, string $audio_variant_key = '' ): ?array

Where one audio source’s transcription stands, for a status tile on your own screen, such as Podcast Workflow’s Transcription tile.

Five statuses: none (no transcript and nothing requested), pending (queued, waiting for a free slot or a retry), processing (with the provider), complete and failed. A tile with four states shows pending as processing. Offer Request transcription when can_request is true: Transcription is on for the show, a provider has accepted the key, the source has audio, and the status is none or failed.

Exactly the source named. A variant with no transcript is none, never the base audio’s status; an unknown key is none with can_request false. A show with Transcription lapsed or switched off answers what it holds, with active and can_request false and editor_url empty.

Parameters

Name Type Default Required Description
$episode_id int — Yes The episode.
$audio_variant_key string '' No Which audio source: '' for the base audio (what the episode list shows and the episode page plays), or a tier's audio variant key.

Return Value

Type: ?array

null for an id that is not an episode. Otherwise status (none, pending, processing, complete or failed), updated_at (UTC, Y-m-d H:i:s, or null for none), error (the reason shown to the podcaster, for failed only), active (Transcription is switched on for the episode's show), can_request (whether benecaster_request_episode_transcription() would queue it now) and editor_url (the episode editor's Transcript tab, '' while Transcription is off for the show).

Example

if ( function_exists( 'benecaster_transcription_status' ) ) {
    $status = benecaster_transcription_status( $episode_id );
    if ( $status && 'complete' === $status['status'] && $status['editor_url'] ) {
        printf( '<a href="%s">%s</a>', esc_url( $status['editor_url'] ), esc_html__( 'View transcript', 'my-addon' ) );
    }
}

Notes

It checks no capability and applies no transcript visibility: a Hidden transcript reports its status like any other. It is for the podcaster's screens; never show it to visitors.

Defined on every request while the add-on is active, whether or not it is on for any show. Guard with function_exists() for a site without it. updated_at is UTC: convert it with wp_date(). Worked example: Show an episode's transcription status, and request one, from your add-on.

Need this built rather than just documented? See our services →