Skip to main content

benecaster_episode_updated

Action Free Since v1.0.0

Fires after an existing episode is saved — every save after the first. Does not fire when an episode is created for the first time; use [benecaster_episode_created](/hooks/benecaster_episode_created/) for that.

`$changed_fields` covers WordPress post-table columns only — any subset of `title`, `content`, `post_status`, `post_date`, `post_date_gmt`, `post_name`, and `post_excerpt`. It is empty when only meta changed, or when no prior snapshot was available (for example, a direct `wp_insert_post()` call). For meta field reactivity use [benecaster_episode_meta_updated](/hooks/benecaster_episode_meta_updated/). For reference changes use [benecaster_episode_references_updated](/hooks/benecaster_episode_references_updated/). For custom field value changes use [benecaster_episode_field_values_updated](/hooks/benecaster_episode_field_values_updated/). For availability date changes use [benecaster_availability_set](/hooks/benecaster_availability_set/).

Parameters

Name Type Default Description
$episode_id int ID of the updated episode post
$show_id int ID of the parent show
$changed_fields array Array of post-table column keys that changed in this save (any subset of title, content, post_status, post_date, post_date_gmt, post_name, post_excerpt). Empty when only meta changed or when no prior snapshot was available.

Examples

Sync changed post fields to external system

add_action( 'benecaster_episode_updated', function (
    int   $episode_id,
    int   $show_id,
    array $changed_fields
) {
    // Skip pure meta updates — nothing post-level changed.
    if ( empty( $changed_fields ) ) {
        return;
    }

    $payload = [ 'episode_id' => $episode_id, 'changed' => $changed_fields ];

    if ( in_array( 'title', $changed_fields, true ) ) {
        $payload['title'] = get_the_title( $episode_id );
    }
    if ( in_array( 'post_status', $changed_fields, true ) ) {
        $payload['status'] = get_post_status( $episode_id );
    }

    wp_remote_post( 'https://api.example.com/episodes/sync', [
        'body'    => wp_json_encode( $payload ),
        'headers' => [ 'Content-Type' => 'application/json' ],
        'timeout' => 5,
    ] );
}, 10, 3 );

Notes

$changed_fields contains post-table column names only — it does not reflect changes to Benecaster meta fields such as audio URL, description, or artwork. It is empty when only meta changed, or when no prior snapshot existed. Use benecaster_episode_meta_updated for meta field reactivity, benecaster_episode_references_updated for reference changes, benecaster_episode_field_values_updated for custom field changes, and benecaster_availability_set for availability date changes. This is a Free hook — it fires regardless of license status. Fires at save_post priority 20.