Closed donmhico closed 1 month ago
To give an update, since v1.12.0
, it's possible to exclude the email logs from being logged using the filter wp_mail_logging_before_log_email
.
Here's an example snippet.
add_filter( 'wp_mail_logging_before_log_email', 'wp_mail_logging_filter' );
function wp_mail_logging_filter( $mail ) {
if ( $mail['to'] === 'filter@gmail.com' ) {
return false;
}
return $mail;
}
This filter only prevents the email to be logged, but will still send the email.
Description
Create a new hook that allows filtering of which emails to log but still sends it. The existing hook
wp_mail_logging_before_log_email
does allow emails not to be logged, but it will also prevent the email to be sent.Reference
See https://wordpress.org/support/topic/exclude-mails-by-address-of-recipment/.