-
-
Save RupW/7ef75c22e88dff18e632eb6676635bd0 to your computer and use it in GitHub Desktop.
Two example implementations for wp_mail_failed
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
// Echo out wp_mail() errors to the current page | |
// from https://developer.wordpress.org/reference/hooks/wp_mail_failed/ | |
function echo_wp_mail_failed( $wp_error ) { | |
echo "<pre>"; | |
print_r($wp_error); | |
echo "</pre>"; | |
} | |
add_action( 'wp_mail_failed', 'echo_wp_mail_failed', 10, 1 ); | |
// Write wp_mail() errors to the debug log | |
function log_wp_mail_failed( $wp_error ) { | |
error_log('wp_mail_failed: ' . print_r( $wp_error, true )); | |
} | |
add_action( 'wp_mail_failed', 'log_wp_mail_failed', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment