-
-
Save Pebblo/bfd6aa3b88a2459668504f75a57bc324 to your computer and use it in GitHub Desktop.
Example of how you can add the returns from wp_mail_error logs to the EE messages error output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Please do not include the opening PHP tag if you already have one. | |
add_filter('FHEE__EE_Email_messenger___headers', 'tw_ee_hacky_wp_mail_error_for_messages__EE_Email_messenger___headers', 10, 3); | |
function tw_ee_hacky_wp_mail_error_for_messages__EE_Email_messenger___headers( $headers, $incoming_message_type, $messenger ){ | |
add_action('wp_mail_failed', 'tw_log_wp_mail_errors', 10, 1); | |
return $headers; | |
} | |
function tw_log_wp_mail_errors($wp_error) | |
{ | |
$wp_mail_errors = implode(",<br />", $wp_error->get_error_messages()); | |
EE_Error::add_error( | |
sprintf( | |
esc_html__( | |
'Errors received from wp_mail_failed hook:%1$s%2$s', | |
'event_espresso' | |
), | |
'<br />', | |
$wp_mail_errors | |
), | |
__FILE__, | |
__FUNCTION__, | |
__LINE__ | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment