Run your own code when a show’s Content Calendar content types are saved
Two actions, ( array $types, int $show_id ), around a save of a show’s list from the Content Types panel or PUT …/types (see Read or change a show’s Content Calendar content types):
- benecaster_content_calendar_before_save_content_types gets the list about to be stored. A built-in type that was never renamed has
name'', meaning its default name in the reader’s language. - benecaster_content_calendar_after_save_content_types gets the saved list exactly as
GETanswers it.
Neither fires for a request refused before the write.
Code
<?php
add_action( 'benecaster_content_calendar_after_save_content_types', function ( array $types, int $show_id ): void {
update_post_meta( $show_id, '_my_addon_calendar_type_count', count( $types ) );
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →