Skip to main content

benecaster_transcript_updated

Action Premium transcription

Fires once, after the Transcription Service add-on stores a change to an episode’s transcript, whatever caused it, so one callback catches every source. More precisely, it fires whenever what benecaster_get_episode_transcript_text() returns for the episode changes, not only when the text does.

$reason says why:

  • transcribed: a provider transcription completed.
  • visibility: a visibility change moved the transcript into or out of Hidden, so the reader now returns null, or the text again. The text itself did not change.
  • imported: a transcript imported from a file, paste or feed changed the text.
  • edited: a correction saved in the episode editor changed the text.
  • deleted is reserved for a transcript removed. After deleted the reader returns null.

Accept values you don’t know: more causes can be added.

For visibility, it fires once per finished transcript of the episode whose own setting changed, or of every episode following a show default that moved into or out of Hidden, after the setting is stored. A change between two settings that are both not Hidden, such as All visitors to Selected tiers, fires nothing, because the reader’s answer is the same. It does not fire when a transcription finishes with the same text the episode already had.

Parameters

Name Type Default Description
$transcript_id int — ID of the transcript that changed
$episode_id int — ID of its episode
$reason string — `transcribed`, `visibility`, `imported` or `edited`, or one of the reserved `imported`, `edited` and `deleted`. Accept values you do not know.

Examples

Re-index an episode in the background whenever its transcript changes

add_action( 'benecaster_transcript_updated', function ( int $transcript_id, int $episode_id, string $reason ): void {
    as_enqueue_async_action( 'my_addon_reindex_episode', [ $episode_id ], 'my-addon' );
}, 10, 3 );

Notes

It runs inside the request or background job that changed the transcript, so do slow work such as re-indexing in a job of your own. It fires for every transcript, whatever its visibility: before you show anything built from the text, check benecaster_user_can_see_transcript(). Walkthrough: Read an episode's transcript, and react when it changes.

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