ActionScheduler_ActionFactory::recurring_unique()publicWC 1.0

Create the first instance of an action recurring on a given interval only if there is no pending or running action with same name and params.

Method of the class: ActionScheduler_ActionFactory{}

No Hooks.


Int. The ID of the stored action.


$ActionScheduler_ActionFactory = new ActionScheduler_ActionFactory();
$ActionScheduler_ActionFactory->recurring_unique( $hook, $args, $first, $interval, $group, $unique );
$hook(string) (required)
The hook to trigger when this action runs.
Args to pass when the hook is triggered.
Default: array()
Unix timestamp for the first run.
Default: null
Seconds between runs.
Default: null
A group to put the action in.
Default: ''
Whether action scheduled should be unique.
Default: true

ActionScheduler_ActionFactory::recurring_unique() code WC 8.7.0

public function recurring_unique( $hook, $args = array(), $first = null, $interval = null, $group = '', $unique = true ) {
	if ( empty( $interval ) ) {
		return $this->single_unique( $hook, $args, $first, $group, $unique );
	$date     = as_get_datetime_object( $first );
	$schedule = new ActionScheduler_IntervalSchedule( $date, $interval );
	$action   = new ActionScheduler_Action( $hook, $args, $schedule, $group );
	return $unique ? $this->store_unique_action( $action ) : $this->store( $action );