benecaster_content_calendar_after_save_item
Fires once a Content Calendar content item has been written: created or edited on the Calendar screen or over the REST API, imported from an .ics file, made from an idea on the Ideas board, or moved to another show with the episode it is linked to. It fires only when the write succeeded.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$item |
array |
— | The content item as saved, with its `id`. Its fields are listed in the walkthrough below. |
$context |
string |
— | `create`, `import` (made by an iCal import), `promote` (made from an idea on the Ideas board), `update`, or `episode_move` (`show_id` is the new show) |
Example
add_action( 'benecaster_content_calendar_after_save_item', function ( array $item, string $context ): void {
if ( 'posted' === $item['status'] && 'tweet' === $item['type'] ) {
my_social_log( $item['show_id'], $item['title'], $item['reference_url'] );
}
}, 10, 2 );
Notes
Dates and times are the site's day and wall-clock time, never UTC. The episode_move 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
- POST benecaster-content-calendar/v1/shows/{show_id}/items
- PUT/PATCH benecaster-content-calendar/v1/shows/{show_id}/items/{id}
- POST benecaster-content-calendar/v1/shows/{show_id}/ical/import
- POST benecaster-content-calendar/v1/shows/{show_id}/ideas/{id}/promote
Need this built rather than just documented? See our services →