Skip to main content

React when a podcaster saves an email design

Premium Intermediate

The two actions fire around a save from the Email Editor; $show_id is 0 for the site-wide design, and the after action does not fire for a refused save. The filter changes the body HTML a design rendered to.

Code

<?php
add_filter( 'benecaster_email_editor_template_html', function ( string $html, array $design, string $type, int $show_id ): string {
    // Leave {{tags}} for core: it substitutes and escapes them at send time.
    return 'welcome' === $type ? $html . '<p>{{show_title}} is made with love.</p>' : $html;
}, 10, 4 );

add_action( 'benecaster_email_editor_after_template_save', function ( int $show_id, string $type, array $design ): void {
    delete_transient( 'my_addon_design_summary_' . $show_id );
}, 10, 3 );

View on GitHub →

Hooks Used

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