Run your own code when an episode’s workflow status, recording or outline changes in Podcast Workflow
An episode’s workflow status is draft, review, approved, scheduled or published. Review and Approved are Podcast Workflow’s own record (post meta _benecaster_workflow_status), never a post_status: Benecaster keeps post_status to draft, future, publish and private. Scheduled and Published are read from the post (private counts as published) and are never set through these hooks.
- Status: benecaster_podcast_workflow_before_status_change and benecaster_podcast_workflow_after_status_change, actions
( int $episode_id, string $new_status, string $old_status, int $show_id ), fired only when the status changes, around the write. On the Workbench,$new_statusand$old_statusaredraft,revieworapproved. Benecaster’s episode note Episode status changed to {status} by {user}. is written between them. - Recording: benecaster_podcast_workflow_before_recording_change and benecaster_podcast_workflow_after_recording_change, actions
( int $episode_id, bool $complete, int $show_id ), fired only on a change, around the write and its episode note. Ticking Recording complete writes the System note Recording marked complete by {user}.; unticking writes Recording marked not complete by {user}.{user}is the signed-in user’s display name (their login when the display name is empty), and the note’s author is that user. No note is written when the value does not change. - Outline: benecaster_podcast_workflow_before_save_outline and benecaster_podcast_workflow_after_save_outline, actions
( int $episode_id, string $outline_html, bool $final, int $show_id ), fired on every save.$outline_htmlis<p>paragraphs with<br>line breaks, every character escaped.
$show_id is the episode’s own show. An after hook fires only once the write is done.
Code
<?php
add_action( 'benecaster_podcast_workflow_after_status_change', function ( int $episode_id, string $new, string $old, int $show_id ): void {
if ( 'approved' === $new ) {
my_plugin_tell_the_editor( $episode_id ); // e.g. post to the team's chat
}
}, 10, 4 );
Hooks Used
Need this built rather than just documented? See our services →