Skip to main content

benecaster_show_trashed

Action Free Since v1.0.0

Fires after a show post is moved to the WordPress Trash. When this hook fires, the show’s post status is already `’trash’`. This is distinct from [benecaster_show_deleted](/hooks/benecaster_show_deleted/), which fires before permanent deletion — trashing is reversible and the show can be restored from the Trash at any time.

Use this hook to suspend the show’s record in external systems without fully removing it. If the show is later restored, the standard WordPress untrash flow brings it back to `publish` status. After this action fires, the show’s plan slot is recovered immediately without a cron delay — another show can be created right away.

Parameters

Name Type Default Description
$show_id int ID of the trashed show post

Examples

Suspend CRM record when show is trashed

add_action( 'benecaster_show_trashed', function( int $show_id ): void {
    $external_id = get_post_meta( $show_id, '_my_crm_show_id', true );
    if ( $external_id ) {
        my_crm_client()->suspend_show( $external_id );
    }
} );

Log show deactivation for audit trail

add_action( 'benecaster_show_trashed', function( int $show_id ): void {
    error_log( sprintf(
        '[Benecaster] Show %d trashed by user %d at %s',
        $show_id,
        get_current_user_id(),
        current_time( 'c' )
    ) );
} );

Notes

The show's plan slot is reclaimed immediately on trash — no cron delay. For permanent, irreversible deletion use benecaster_show_deleted. The show post remains readable while trashed; restore it via standard WordPress untrash to bring it back to publish status. Fires only for benecaster_show posts (not other post types). Internally wired to the WordPress wp_trash_post hook.