Skip to main content

benecaster_site_connected

Action Free

Fires after a site successfully completes the OAuth connection flow to benecaster.com and the site token has been stored. The plan and license status options are written before this action fires, so both are readable from the callback.

Use for post-connection provisioning — seeding add-on defaults, notifying an external system, or triggering a first sync. Fires once per successful connection, including reconnections.

Parameters

Name Type Default Description
$data array Connection payload from the license server. Keys include `plan`, `license_id`, `prefix`, and `granted_at`; individual keys are not guaranteed present, so check before reading.

Examples

Seed add-on defaults on first connect

add_action( 'benecaster_site_connected', function ( array $data ): void {
    if ( get_option( 'my_addon_defaults_seeded' ) ) {
        return;
    }
    my_addon_seed_defaults( $data['plan'] ?? '' );
    update_option( 'my_addon_defaults_seeded', 1 );
} );

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