ActionScheduler_ActionFactory::async()publicWC 1.0

Enqueue an action to run one time, as soon as possible (rather a specific scheduled time).

This method creates a new action with the NULLSchedule. This schedule maps to a MySQL datetime string of
0000-00-00 00:00:00. This is done to create a psuedo "async action" type that is fully backward compatible. Existing queries to claim actions claim by date, meaning actions scheduled for 0000-00-00 00:00:00 will always be claimed prior to actions scheduled for a specific date. This makes sure that any async action is given priority in queue processing. This has the added advantage of making sure async actions can be claimed by both the existing WP Cron and WP CLI runners, as well as a new async request runner.

{} Это метод класса: ActionScheduler_ActionFactory{}

Хуков нет.


int. The ID of the stored action


$ActionScheduler_ActionFactory = new ActionScheduler_ActionFactory();
$ActionScheduler_ActionFactory->async( $hook, $args, $group );
$hook(строка) (обязательный)
The hook to trigger when this action runs
Args to pass when the hook is triggered
По умолчанию: array()
A group to put the action in
По умолчанию: ''

Код ActionScheduler_ActionFactory::async() WC 6.9.4

public function async( $hook, $args = array(), $group = '' ) {
	$schedule = new ActionScheduler_NullSchedule();
	$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
	return $this->store( $action );