Trigger a workflow when a new episode is first created
Fires exactly once per episode lifetime on the first save. Use to bootstrap external records — a project management task, a CMS entry, or an audit trail row — before the episode enters the editorial workflow. Note: meta (audio URL, description, etc.) is not yet written when this fires; read it lazily or hook updated_post_meta if needed.
Code
<?php
add_action( 'benecaster_episode_created', function ( int $episode_id, int $show_id ) {
my_pm_create_task( [
'name' => get_the_title( $episode_id ),
'show_id' => $show_id,
'wp_id' => $episode_id,
'status' => 'draft',
] );
}, 10, 2 );