Log wp_mail() Errors

This helps you debug some error when wp_mail seems to be not sending mail. It will log wp_mail errors your error log file.

PHP

/**
 * Log wp_mail Errors.
 */
add_action('wp_mail_failed', function($error){
	error_log(print_r($error->errors['wp_mail_failed'], true));
});

By

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]