Skip to main content

Mark add-on email types as transactional so they bypass broadcast opt-out

Free Beginner Since v1.0.0

UnsubscribeManager protects a fixed set of transactional types from broadcast opt-out suppression. Add-ons that send time-sensitive operational emails (access-expiry warnings, billing notifications) should add their type here so opted-out subscribers still receive them. Types added here bypass broadcast_opted_out but are still suppressed by all_opted_out (the user’s request to receive no Benecaster emails at all). Only mark types as transactional when the subscriber has a genuine operational expectation of receiving them.

Code

<?php
add_filter( 'benecaster_transactional_email_types', function ( array $types ): array {
    // Ensure our add-on's operational email is never suppressed by broadcast opt-out.
    $types[] = 'my_addon_access_expiry';
    return $types;
} );

View on GitHub →

Hooks Used