benecaster_email_wrapper_args
Filters the context array passed to the email wrapper (header and footer) before rendering. Keys: logo_url, show_name, accent_color, footer_text, business_address, preheader, is_admin_email. It fires for every email Benecaster wraps, including one whose wrapper comes from benecaster_email_template_wrapper: that wrapper is filled from these values.
Return the array. Cast with (array). The recognised keys are logo_url, show_name, accent_color (default #1a73e8), footer_text, business_address and preheader.
preheader is the inbox preview text, the line an inbox shows beside the subject. It defaults to the send’s preheader merge tag (a broadcast’s preview text) and is empty otherwise. Give plain text: Benecaster escapes it, and its built-in wrapper pads it with invisible filler characters so the body’s first words do not trail after it in the inbox. Do not add filler yourself.
Returning an empty array does not restore the defaults — it removes every value, and the wrapper renders with an empty accent colour and no footer. Modify and return the array you were given. A key the wrapper does not recognise is ignored silently rather than warning, so a misspelled key reads as “the filter did nothing”.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$args |
array |
— | Template context: logo_url (string), show_name (string), accent_color (string hex), footer_text (string), business_address (string) — CAN-SPAM-compliant physical postal address, defaults to the show's Settings → [Show] → Emails value (also collected on the setup wizard's details step); rendered as its own footer line on every email type when non-empty, omitted entirely when empty — preheader (string) — inbox preview text, plain text — is_admin_email (bool; reserved, always false: there is no separate admin footer) |
$email_type |
string |
— | Email type string |
$show_id |
int |
— | ID of the show |
Returns:
array
Example
add_filter( 'benecaster_email_wrapper_args', function( $args, $email_type, $show_id ) {
// Use a show-specific accent color stored in post meta.
if ( $show_id ) {
$brand_color = get_post_meta( $show_id, '_benecaster_brand_color', true );
if ( $brand_color ) {
$args['accent_color'] = $brand_color;
}
}
return $args;
}, 10, 3 );
Need this built rather than just documented? See our services →