benecaster_email_from_name
Filters the sender name for any Benecaster email.
A type-specific variant is available — append the email type to the hook name (e.g. benecaster_email_from_name_welcome) to target a single type; the $email_type parameter is omitted on the type-specific variant.
Return a string. Cast with (string).
A type-specific variant runs immediately AFTER this one and can overwrite it: benecaster_email_from_name_{$type} (e.g. benecaster_email_from_name_welcome). Its signature is different — the $type parameter is dropped, since the type is in the hook name — so a callback moved from one to the other silently receives the user ID where it expects the type.
This filter fires from two places with a meaningful difference: EmailManager passes the real $user_id, while the functions.php preview path passes null. A callback dereferencing the user ID must tolerate null or it fatals when a podcaster previews the template.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$from_name |
string |
— | Sender name |
$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_from_name', function( $from_name, $email_type, $user_id, $show_id ) {
// Use the show name as the sender name for episode notifications.
if ( 'episode_notification' === $email_type && $show_id ) {
return get_the_title( $show_id );
}
return $from_name;
}, 10, 4 );
Need this built rather than just documented? See our services →