benecaster_is_import()
benecaster_is_import(): bool
Tells an imported listener from a live signup. The Migration Wizard brings listeners over from another platform through the same path a signup takes, so benecaster_token_generated, benecaster_token_reactivated and benecaster_token_type_changed carry the same arguments for both. An email integration asks this to keep a whole imported audience off a mailing list.
Return Value
Type:
bool
true while a token is being written inside benecaster_run_as_import(), false otherwise.
Example
add_action( 'benecaster_token_generated', function ( int $token_id, int $user_id, int $show_id ): void {
// Ask here and decide here: a queued job always hears false.
if ( benecaster_is_import() || benecaster_is_member_sync() ) {
return; // Imported or synced: not a new signup.
}
as_enqueue_async_action( 'my_addon_add_to_list', [ $user_id, $show_id ] );
}, 10, 3 );
Notes
Ask while the action is running, never later. It is true only during the token write, so a listener that queues work must ask first and decide there: a queued job always hears false.
Bulk Enroll Subscribers is not an import, so it answers false: a podcaster uses it to add people as new members. Sync Existing Members answers false too; ask benecaster_is_member_sync() for that. Worked example: Add only new signups to your mailing list, not imported or synced listeners.
Need this built rather than just documented? See our services →