Skip to main content

benecaster_content_calendar_before_delete_item

Action Premium content-calendar

Fires before a Content Calendar content item is deleted: from the Calendar screen or over the REST API, or because the episode it is linked to was deleted for good.

Parameters

Name Type Default Description
$item array — The content item about to be deleted. Its fields are listed in the walkthrough below.
$context string — `delete`, or `episode_deleted` (the linked episode was deleted for good)

Example

add_action( 'benecaster_content_calendar_before_delete_item', function ( array $item, string $context ): void {
    my_audit_log( 'calendar-item-deleting', $item['show_id'], $item['title'] . ' (' . $context . ')' );
}, 10, 2 );

Notes

Moving an episode to the Trash deletes nothing, so it does not fire this. The episode_deleted context fires even while Content Calendar is off for every show. Walkthrough, with every field of $item: Run your own code when a Content Calendar content item is saved or deleted.

Affects

  • Calendar screen
  • DELETE benecaster-content-calendar/v1/shows/{show_id}/items/{id}

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