Skip to main content

Trigger a workflow when a new episode is first created

Free Beginner

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( [
        // get_the_title() returns HTML (Dave’s Q&A); this is plain text.
        'name'    => html_entity_decode( get_the_title( $episode_id ), ENT_QUOTES, 'UTF-8' ),
        'show_id' => $show_id,
        'wp_id'   => $episode_id,
        'status'  => 'draft',
    ] );
}, 10, 2 );

View on GitHub →

Hooks Used

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