Skip to main content

benecaster_addon_activation_changed

Action Free

Fires after a podcaster switches an add-on on or off for one show, from Settings → Add-ons.

This is an ACTIVATION change, not an entitlement change, and the whole page depends on the difference. The customer still owns the add-on — they have chosen not to run it on this show, and are expected to switch it back. An add-on that treats this as a revocation and tears down purchased data destroys something the customer still pays for, and the next $enabled = true cannot undo a delete.

What a listener may safely do: drop per-show caches and transients, unschedule per-show cron events, clear a rendered fragment, tell your own service the show’s state moved. What it must not do: delete anything the customer authored or paid for.

Parameters

Name Type Default Description
$addon_slug string — The add-on that was switched.
$show_id int — The show it was switched for. Activation is always per show.
$enabled bool — `true` when switched on, `false` when switched off.

Examples

Tear down per-show cached state on switch-off

add_action( 'benecaster_addon_activation_changed', function ( string $slug, int $show_id, bool $enabled ): void {
    if ( 'my-addon' !== $slug || $enabled ) {
        return;
    }

    delete_transient( 'my_addon_cache_' . $show_id );
    wp_clear_scheduled_hook( 'my_addon_nightly', [ $show_id ] );
}, 10, 3 );

Notes

Fired by REST\AddonActivationController::update() after the activation layer is written. It never fires for an entitlement change — grants arrive from the license server through LicenseValidationCron and do not pass through here.

A slug the show's license does not grant is refused with 400 addon_not_granted before any write, so this action never fires for one.

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