Merge pull request #14344 from woocommerce/remove/defer-email-default

Set default email sending method to not defer
This commit is contained in:
Claudio Sanches 2017-04-13 12:29:34 -03:00 committed by GitHub
commit ef8136b135
1 changed files with 10 additions and 4 deletions

View File

@ -88,7 +88,7 @@ class WC_Emails {
'woocommerce_created_customer', 'woocommerce_created_customer',
) ); ) );
if ( apply_filters( 'woocommerce_defer_transactional_emails', true ) ) { if ( apply_filters( 'woocommerce_defer_transactional_emails', false ) ) {
self::$background_emailer = new WC_Background_Emailer(); self::$background_emailer = new WC_Background_Emailer();
foreach ( $email_actions as $action ) { foreach ( $email_actions as $action ) {
@ -139,9 +139,15 @@ class WC_Emails {
* @param array $args Email args (default: []). * @param array $args Email args (default: []).
*/ */
public static function send_transactional_email( $args = array() ) { public static function send_transactional_email( $args = array() ) {
$args = func_get_args(); try {
self::instance(); // Init self so emails exist. $args = func_get_args();
do_action_ref_array( current_filter() . '_notification', $args ); self::instance(); // Init self so emails exist.
do_action_ref_array( current_filter() . '_notification', $args );
} catch ( Exception $e ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
trigger_error( 'Transactional email triggered fatal error for callback ' . current_filter(), E_USER_WARNING );
}
}
} }
/** /**