Skip to main content

benecaster_email_subject

Filter Free Since v1.0.0

Filters the email subject line for any Benecaster email. A type-specific variant is available — append the email type to the hook name (e.g. benecaster_email_subject_welcome); the $email_type parameter is omitted on the type-specific variant.

Parameters

Name Type Default Description
$subject string Email subject line
$email_type string Email type string
$user_id int|null WordPress user ID; null for admin-only emails
$show_id int|null ID of the show; null when not show-specific

Returns: string

Example

add_filter( 'benecaster_email_subject', function( $subject, $email_type, $user_id, $show_id ) {
    // Prefix episode notification subjects with the show name.
    if ( 'episode_notification' === $email_type && $show_id ) {
        $show_name = get_the_title( $show_id );
        $subject   = '[' . $show_name . '] ' . $subject;
    }
    return $subject;
}, 10, 4 );