Skip to main content

benecaster_episode_field_values_updated

Action Free

Fires after custom field values on an episode change, from every write path: the episode editor’s save, and benecaster_update_field(), so values an importer or an add-on writes reach your listener as well as a podcaster’s edits. It fires once per save. A multi-field editor save fires it once, naming every changed field; each benecaster_update_field() call is its own save, so it fires once per call.

$changed_field_ids holds only the fields whose stored value actually differs. Saving an unchanged value fires nothing, and clearing a stored value counts as a change. It fires for episodes only, and not at all when the episode post cannot be loaded.

benecaster_episode_updated does not fire when custom field values change; this is the correct hook for custom-field reactivity on episodes. For a lower-level hook that fires once per field (across all CPTs), use 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[] Field definition IDs that changed in this save — pass each to `benecaster_get_field()`

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 change — use this hook for custom-field reactivity. benecaster_field_value_saved is a lower-level hook that fires once per field, changed or not; this hook fires once per save as a summary of the changed fields, making it easier to process all changes without repeated callbacks. Only fires for the benecaster_episode CPT.

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