Skip to main content

benecaster_email_body_text

Filter Free

Filters the plain text version of any Benecaster email. Sent as the text/plain part of the multipart email. If not overridden, the plain text part is auto-generated from the final filtered HTML — meaning changes made via benecaster_email_body_html cascade here automatically. Use this filter when you need the plain text to diverge from the HTML version.

A type-specific variant is available — append the email type to the hook name (e.g. benecaster_email_body_text_welcome) to target a single type; the $email_type parameter is omitted on the type-specific variant.

$related_id says which send the email belongs to; see Tell which send an email belongs to.

Parameters

Name Type Default Description
$body_text string — Email plain text body
$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
$related_id int — The send this email belongs to: a broadcast's id, or the `related_id` passed to `benecaster_send_email()` in its context. `0` for a one-off or a preview. A send is this id and the email type together. Register with 5 accepted args to receive it; on the type-specific variant it is the fourth argument

Returns: string

Example

add_filter( 'benecaster_email_body_text', function( $body_text, $email_type, $user_id, $show_id ) {
    // Append an unsubscribe reminder to the plain-text version.
    return $body_text . "\n\nManage your subscription preferences via the link in the footer.";
}, 10, 4 );

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