diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index ae1d4142ca..4bbcaacb8f 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -158,6 +158,9 @@ endif; if ( !function_exists( 'wp_mail' ) ) : function wp_mail( $to, $subject, $message, $headers = '' ) { + // Compact the input, apply the filters, and extract them back out + extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers' ) ) ); + global $phpmailer; // (Re)create it, if it's gone missing @@ -167,9 +170,6 @@ function wp_mail( $to, $subject, $message, $headers = '' ) { $phpmailer = new PHPMailer(); } - // Compact the input, apply the filters, and extract them back out - extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers' ) ), EXTR_SKIP ); - // Headers if ( empty( $headers ) ) { $headers = array();