WC_Background_Emailer::taskprotectedWC 1.0

Task

Override this method to perform any actions required on each queue item. Return the modified item for further processing in the next pass through. Or, return false to remove the item from the queue.

Method of the class: WC_Background_Emailer{}

No Hooks.

Returns

Mixed.

Usage

// protected - for code of main (parent) or child class
$result = $this->task( $callback );
$callback(array) (required)
Update callback function.

WC_Background_Emailer::task() code WC 10.7.0

protected function task( $callback ) {
	if ( isset( $callback['filter'], $callback['args'] ) ) {
		try {
			WC_Emails::send_queued_transactional_email( $callback['filter'], $callback['args'] );
		} catch ( Exception $e ) {
			if ( Constants::is_true( 'WP_DEBUG' ) ) {
				trigger_error( 'Transactional email triggered fatal error for callback ' . esc_html( $callback['filter'] ), E_USER_WARNING ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
			}
		}
	}
	return false;
}