benecaster_membership_tier_deleted
Fires after a built-in membership tier is permanently deleted. The tier row no longer exists in the database when this action fires, but the full pre-deletion data is passed as the fourth parameter so listeners can clean up external resources without re-querying. All six Stripe ID columns are included in `$tier`, making it straightforward to archive or cancel related Stripe resources in the same callback.
This is a Phase 2 hook, available only when the built-in Stripe membership feature is active. The `$tier` fourth argument was added in a later batch; existing listeners registered with three parameters continue to work.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$tier_id |
int |
— | ID of the deleted tier |
$show_id |
int |
— | ID of the show |
$tier_slug |
string |
— | Slug of the deleted tier |
Examples
Archive Stripe Products and sync deletion externally
add_action( 'benecaster_membership_tier_deleted', function (
int $tier_id, int $show_id, string $tier_slug, array $tier
): void {
// Archive Stripe Products for both keysets
$stripe_ids = array_filter( [
$tier['stripe_product_id_test'],
$tier['stripe_product_id_live'],
] );
foreach ( $stripe_ids as $product_id ) {
my_archive_stripe_product( $product_id );
}
// Sync deletion to external analytics
my_analytics_sync( 'tier_deleted', [
'tier_id' => $tier_id,
'tier_slug' => $tier_slug,
'show_id' => $show_id,
] );
}, 10, 4 );
Notes
The tier row no longer exists in the database when this action fires. Use the $tier array to access all pre-deletion data, including Stripe product IDs for both test and live keysets. Pass 10, 4 as the priority and accepted-args arguments to receive the $tier parameter.