apply_filters( 'wp_mail', array $args )
Filters the wp_mail() arguments.
Description Description
Parameters Parameters
- $args
-
(array) A compacted array of wp_mail() arguments, including the "to" email, subject, message, headers, and attachments values.
Source Source
Changelog Changelog
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
modify the recipient of the email
add_filter('wp_mail','redirect_mails', 10,1); function redirect_mails($args){ $to = $args['to']; //$args['subject'] //$args['message'] //$args['headers'] //$args['attachments'] $user = get_user_by( 'email', $to); $_role = get_user_meta($user->ID, 'my_custom_role', true); if ($role == 'opportunity-owner') { $test_mentor_email = get_option('test_mentor_email'); if ($test_mentor_email != '') { $to = $test_mentor_email; } } $args['to']=$to; return $args; }Expand full source codeCollapse full source code