Skip to main content

benecaster_episode_field_values_updated

Action Free Since v1.0.0

Fires after custom field values are saved on an episode via the custom fields REST endpoint (`POST /benecaster/v1/field-values/benecaster_episode/{id}`), providing a summary of which field IDs actually changed. Only fires when at least one submitted value differed from its stored value — does not fire when every submitted value is identical to what is already stored.

[benecaster_episode_updated](/hooks/benecaster_episode_updated/) does not fire when custom field values are saved through this endpoint; this is the correct hook for custom-field reactivity on episodes. For a lower-level hook that fires once per field per save (across all CPTs), use [benecaster_field_value_saved](/hooks/benecaster_field_value_saved/). To look up the field definition or current value for a given ID, call `benecaster_get_field( $field_id, $episode_id )`.

Parameters

Name Type Default Description
$episode_id int ID of the episode post
$show_id int ID of the parent show
$changed_field_ids int[] Array of benecaster_fields.id values that changed in this save

Examples

Sync changed fields to external CMS

add_action( 'benecaster_episode_field_values_updated', function (
    int   $episode_id,
    int   $show_id,
    array $changed_field_ids
): void {
    foreach ( $changed_field_ids as $field_id ) {
        $value = benecaster_get_field( $field_id, $episode_id );
        my_addon_sync_field( $episode_id, $field_id, $value );
    }
}, 10, 3 );

Notes

benecaster_episode_updated does not fire when custom field values are saved via this endpoint — use this hook for custom-field reactivity. benecaster_field_value_saved is a lower-level hook that fires once per field per save; this hook fires once per request as a batch summary, making it easier to process all changes without repeated callbacks. Only fires for the benecaster_episode CPT.