Abstract_WC_Order_Data_Store_CPT::restore_transactional_email_dispatchprotectedWC 10.9.0

Restores the transactional email dispatch listeners previously neutralized by {@see suspend_transactional_email_dispatch()} to their original callbacks.

Method of the class: Abstract_WC_Order_Data_Store_CPT{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->restore_transactional_email_dispatch( $suspended ): void;
$suspended(array) (required)
.

Changelog

Since 10.9.0 Introduced.

Abstract_WC_Order_Data_Store_CPT::restore_transactional_email_dispatch() code WC 11.0.1

protected function restore_transactional_email_dispatch( array $suspended ): void {
	global $wp_filter;

	foreach ( $suspended as $entry ) {
		list( $action, $priority, $key, $function ) = $entry;
		if ( ! isset( $wp_filter[ $action ] ) || ! $wp_filter[ $action ] instanceof WP_Hook ) {
			continue;
		}
		// Only restore the slot if it still exists; if it was removed during the
		// suspended window we must not resurrect it.
		if ( ! isset( $wp_filter[ $action ]->callbacks[ $priority ][ $key ] ) ) {
			continue;
		}
		$wp_filter[ $action ]->callbacks[ $priority ][ $key ]['function'] = $function;
	}
}