benecaster_managed_email_types
Filters the array of registered email types available across the plugin. Every type returned by this filter appears as an editable template in the Email Editor add-on’s template manager. Core registers `welcome`, `token_reset`, and `token_revoked` unconditionally at boot. A Phase 2 built-in membership feature registers four additional billing types when active: `subscription_receipt`, `renewal_reminder`, `payment_failed`, and `subscription_cancelled`. Add-ons register their own types by hooking this filter at plugin boot.
Each type definition is an associative array with four required keys: `type` (a stable snake_case identifier unique across all plugins), `label` (human-readable name shown in the Email Editor), `description` (one-sentence summary of when the email is sent), and `add_on` (the registering add-on’s slug, or `null` for core types). The `type` string becomes part of type-specific hook names — keep it stable after release.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$types |
array |
— | Ordered array of type definition arrays: {type: string, label: string, description: string, add_on: string|null} |
Returns:
array
Examples
Register weekly digest email type
add_filter( 'benecaster_managed_email_types', function( $types ) {
// Register a custom "weekly_digest" email type for an add-on.
$types[] = [
'type' => 'weekly_digest',
'label' => 'Weekly Digest',
'description' => 'A curated weekly roundup sent every Monday.',
'add_on' => 'my-digest-addon',
];
return $types;
} );
Register type at plugin boot
add_action( 'benecaster_boot', function ( \Benecaster\Container $container ): void {
add_filter( 'benecaster_managed_email_types', function ( array $types ): array {
$types[] = [
'type' => 'my_episode_notification',
'label' => __( 'Episode Notification', 'my-addon' ),
'description' => __( 'Sent to subscribers when a new episode becomes available for their tier.', 'my-addon' ),
'add_on' => 'my-addon',
];
return $types;
} );
} );
Notes
Register this filter at benecaster_boot, not init. The filter is read during plugin boot — registering on init or later may mean your type is absent when the Email Editor queries the list. Do not reuse any core type string (welcome, token_reset, token_revoked, subscription_receipt, renewal_reminder, payment_failed, subscription_cancelled) as your own type value.