ActionScheduler_Store::cancel_actions_by_hook()publicWC 3.0.0

Cancel pending actions by hook.

Method of the class: ActionScheduler_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

$ActionScheduler_Store = new ActionScheduler_Store();
$ActionScheduler_Store->cancel_actions_by_hook( $hook );
$hook(string) (required)
Hook name.

Changelog

Since 3.0.0 Introduced.

ActionScheduler_Store::cancel_actions_by_hook() code WC 8.7.0

public function cancel_actions_by_hook( $hook ) {
	$action_ids = true;
	while ( ! empty( $action_ids ) ) {
		$action_ids = $this->query_actions(
			array(
				'hook'     => $hook,
				'status'   => self::STATUS_PENDING,
				'per_page' => 1000,
				'orderby'  => 'none',
			)
		);

		$this->bulk_cancel_actions( $action_ids );
	}
}