Skip to main content

benecaster_subscription_cancelled

Action Premium

Fires when any bridge reports that a subscription has been cancelled. This hook is bridge-agnostic — it fires regardless of which membership plugin triggered the cancellation. The subscriber’s token is marked inactive after this hook fires, and feed access ends on the subscriber’s next poll.

Note there is a brief window between when this hook fires and when the subscriber’s next feed request arrives. During that window, the subscriber may still have feed access even though their token is deactivated.

It does not fire for a built-in-membership subscriber who moves to the show’s free plan, even though their paid Stripe subscription ends: they stay a member. See benecaster_subscription_free_switch_landed.

It fires when access actually ends, not when the member clicks cancel. On Restrict Content Pro and WooCommerce Subscriptions a member who cancels with time left keeps their feed until the end of the paid term, and this fires once, then. On Restrict Content Pro that is when RCP marks the membership Expired; a member who chose to leave gets this hook, never benecaster_subscription_expired. A Paid Memberships Pro move between two levels mapped on the same show is a plan change and fires nothing here.

Parameters

Name Type Default Description
$user_id int — Subscriber user ID.
$show_id int — Show post ID.

Examples

Remove active tag and add churned tag in email platform

add_action( 'benecaster_subscription_cancelled', function (
    int $user_id,
    int $show_id
) {
    $email = get_userdata( $user_id )->user_email;

    my_email_platform_remove_tag( $email, 'active-subscriber' );
    my_email_platform_add_tag( $email, 'cancelled', [
        'show_id'      => $show_id,
        'cancelled_at' => current_time( 'mysql' ),
    ] );
}, 10, 2 );

Need this built rather than just documented? See our services →