as_has_scheduled_action()WC .

It's recommended to use this function when you need to know whether a specific action is currently scheduled (pending or in-progress).

Хуков нет.

Возвращает

true|false. True if a matching action is pending or in-progress, false otherwise.

Использование

as_has_scheduled_action( $hook, $args, $group );
$hook(строка) (обязательный)
The hook of the action.
$args(массив)
Args that have been passed to the action. Null will matches any args.
По умолчанию: null
$group(строка)
The group the job is assigned to.
По умолчанию: ''

Список изменений

С версии . Введена.
Since x.x.x

Код as_has_scheduled_action() WC 7.1.1

function as_has_scheduled_action( $hook, $args = null, $group = '' ) {
	if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
		return false;
	}

	$query_args = array(
		'hook'     => $hook,
		'status'   => array( ActionScheduler_Store::STATUS_RUNNING, ActionScheduler_Store::STATUS_PENDING ),
		'group'    => $group,
		'orderby'  => 'none',
	);

	if ( null !== $args ) {
		$query_args['args'] = $args;
	}

	$action_id = ActionScheduler::store()->query_action( $query_args );

	return $action_id !== null;
}