Skip to main content

Register a custom email type with the Email Editor

Free Intermediate Since v1.0.0

Any email type registered via benecaster_managed_email_types appears as an editable template in the Email Editor UI. Add-ons that send their own email types — episode notifications, community alerts, digest emails — should register them here so podcasters can customize the templates without code. Core registers welcome, token_reset, and token_revoked via this same filter.

Code

<?php
add_action( 'benecaster_boot', function ( \Benecaster\Container $container ) {
    add_filter( 'benecaster_managed_email_types', function ( array $types ): array {
        $types[] = [
            'type'        => 'my_episode_notification',
            'label'       => 'Episode Notification',
            'description' => 'Sent to subscribers when a new episode becomes available for their tier.',
            'add_on'      => 'my-addon-slug',
        ];
        return $types;
    } );
} );

View on GitHub →

Hooks Used