Skip to main content

benecaster_episode_move_after

Action Free

Fires after an episode has moved to another show, once everything Benecaster owns has been moved over and both shows’ feed caches are cleared. Use it to move your own data that is keyed to the episode and its show, such as a per-show sync record, redirect or sponsorship slot.

What Benecaster has already done by now:

  • The episode belongs to the new show.

  • Its availability is cleared, so the episode is in no feed of either show until the podcaster gives it dates.

  • Audio versions are kept only for tiers the new show has.

  • The episode type becomes full if the new show has no type with the same slug.

  • Its references point at the new show’s reference library, and their groups at the new show’s groups with the same names.

  • Its episode notes belong to the new show, and a note records the move.

  • A stamped credit loses its source if the new show has no credit template with that ID. The stamped text stays.

Download history is not moved. Download records keep the show that served them, so leave your own per-show analytics where they are.

Data keyed to a reference library item follows benecaster_episode_references_moved instead. It says which item in the new show’s library each cited item became; this action does not.

Parameters

Name Type Default Description
$episode_id int — ID of the episode that moved
$from_show_id int — ID of the show it left
$to_show_id int — ID of the show it now belongs to

Examples

Move a per-show record with the episode

add_action( 'benecaster_episode_move_after', function (
    int $episode_id,
    int $from_show_id,
    int $to_show_id
) {
    global $wpdb;
    $wpdb->update(
        $wpdb->prefix . 'my_sponsor_slots',
        [ 'show_id' => $to_show_id ],
        [ 'episode_id' => $episode_id, 'show_id' => $from_show_id ],
        [ '%d' ],
        [ '%d', '%d' ]
    );
}, 10, 3 );

Notes

benecaster_episode_updated and the WordPress save_post hooks also fire during a move, but $changed_fields does not list the show. This pair of hooks is the only reliable signal that an episode changed shows. A move is not a delete: benecaster_episode_deleted does not fire.

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