uo_verified_email_headers
Filters user verification email headers. Filters the email headers sent for user verification, allowing modification of outgoing email content.
add_filter( 'uo_verified_email_headers', $callback, 10, 1 );
Description
Allows developers to modify the email headers for user verification emails. This filter fires after default headers are set but before the email is sent. Developers can add, remove, or alter headers like 'From', 'Reply-To', or custom headers to customize email delivery or content.
Usage
add_filter( 'uo_verified_email_headers', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
// Add a custom header to the user verification email to include the WordPress site title.
add_filter( 'uo_verified_email_headers', function( $headers, $user ) {
// Get the current WordPress site title.
$site_title = get_bloginfo( 'name' );
// Add a custom header, for example, 'X-Site-Name'.
$headers[] = 'X-Site-Name: ' . $site_title;
// Return the modified headers array.
return $headers;
}, 10, 2 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/classes/frontend-login-plus.php:1534
src/classes/frontend-login-plus.php:1545
$headers[] = 'From: ' . $from;
/**
* Filters user verification email headers.
*
* @param array $headers The email headers.
* @param WP_User $user The verified user.
*/
$headers = apply_filters( 'uo_verified_email_headers', $headers, $user );
$mailed = wp_mail( $to, $subject, $body, $headers );
// after wp_mail successful
$from = $blog_name . ' <' . $admin_email . '>';
$headers[] = 'From: ' . $from;
/**
* Filters user verification email headers.
*