benecaster_episode_references_updated
Fires after a reference entry is created, updated, or deleted on an episode, via the episode references REST endpoints. The `$action` parameter is one of `’created’`, `’updated’`, or `’deleted’`, corresponding to `POST`, `PUT`, and `DELETE` requests on `/benecaster/v1/episodes/{id}/references`. One hook invocation fires per HTTP request — reference operations happen one at a time.
[benecaster_episode_updated](/hooks/benecaster_episode_updated/) does not fire when references are modified — this is the correct hook for reference reactivity on episodes. For changes to reference library records themselves there is no dedicated hook; use the WordPress `updated_post_meta` hook or a direct database query if you need to react to library edits.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$episode_id |
int |
— | ID of the episode post |
$show_id |
int |
— | ID of the parent show |
$action |
string |
— | One of 'created', 'updated', or 'deleted' |
$reference_id |
int |
— | The affected benecaster_references.id |
Examples
Invalidate cache and log reference deletions
add_action( 'benecaster_episode_references_updated', function (
int $episode_id,
int $show_id,
string $action,
int $reference_id
): void {
// Flush any cached rendering of this episode's show notes.
delete_transient( 'my_show_notes_' . $episode_id );
// Optionally log deletions for audit purposes.
if ( 'deleted' === $action ) {
error_log( sprintf(
'Reference %d removed from episode %d (show %d)',
$reference_id,
$episode_id,
$show_id
) );
}
}, 10, 4 );
Notes
benecaster_episode_updated does not fire when references are modified — use this hook for reference reactivity. For changes to reference library records in benecaster_reference_library there is no dedicated hook. This is a Free hook — it fires regardless of license status.