benecaster_podcast_workflow_plan_from_preset
Filters the tasks a new Podcast Workflow production plan starts with, copied from the show’s preset task list. It runs when a plan is started: automatically for a new draft, pending or scheduled episode, or from POST /benecaster-podcast-workflow/v1/shows/{show_id}/episodes/{episode_id}/plan.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$tasks |
array |
— | The tasks copied from the preset list: `[ { id, name, offset_days, duration_days, preset_id } ]`. A row that is not a valid task is dropped. |
$episode_id |
int |
— | The episode the plan is for |
$show_id |
int |
— | The episode's own show |
Returns:
array
Example
// Add a one-off task to every plan started on show 12.
add_filter( 'benecaster_podcast_workflow_plan_from_preset', function ( array $tasks, int $episode_id, int $show_id ): array {
if ( 12 === $show_id ) {
$tasks[] = [ 'id' => 'my-plugin-legal-check', 'name' => 'Legal check', 'offset_days' => -3, 'duration_days' => 1, 'preset_id' => '' ];
}
return $tasks;
}, 10, 3 );
Notes
Give a one-off task preset_id ''. The plan is copied once, so later changes to the preset list never reach it. Walkthrough: Read or change an episode's production plan, change how a new plan starts, and run code when a plan is finalised.
Affects
- Workbench
- POST benecaster-podcast-workflow/v1/shows/{show_id}/episodes/{episode_id}/plan
- New episodes on a show with Podcast Workflow on
Need this built rather than just documented? See our services →