benecaster_membership_tier_updated
Fires after a built-in membership tier is updated via the Benecaster admin. The $previous parameter holds the full tier row before the update — compare it with $tier to detect specific changes without re-querying. The hook fires for all field changes: name, slug, price, description, trial days, badge assignments, and the active toggle.
This hook is available only when the built-in Stripe membership feature is active. The $previous third argument was added in a later batch; existing listeners registered with two parameters continue to work.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$tier_id |
int |
— | ID of the tier |
$tier |
array |
— | The tier row after the update |
$previous |
array |
— | The tier row before the update |
Examples
Sync pricing when monthly or annual price changes
add_action( 'benecaster_membership_tier_updated', function (
int $tier_id, array $tier, array $previous
): void {
$monthly_changed = $tier['monthly_price'] !== $previous['monthly_price'];
$annual_changed = $tier['annual_price'] !== $previous['annual_price'];
if ( $monthly_changed || $annual_changed ) {
my_sync_tier_pricing( $tier_id, $tier );
}
}, 10, 3 );
Notes
Pass 10, 3 as the priority and accepted-args arguments to receive the $previous parameter. Both $tier and $previous include all columns from the membership tiers table, including Stripe price and product IDs for test and live keysets.
Need this built rather than just documented? See our services →