functions.php
Table of Contents
- wc_schedule_single_action() : string
- Schedule an action to run one time
- wc_schedule_recurring_action() : string
- Schedule a recurring action
- wc_schedule_cron_action() : string
- Schedule an action that recurs on a cron-like schedule.
- wc_unschedule_action() : mixed
- Cancel the next occurrence of a job.
- wc_next_scheduled_action() : int|bool
- wc_get_scheduled_actions() : array<string|int, mixed>
- Find scheduled actions
Functions
wc_schedule_single_action()
Schedule an action to run one time
wc_schedule_single_action(int $timestamp, string $hook[, array<string|int, mixed> $args = array() ][, string $group = '' ]) : string
Parameters
- $timestamp : int
-
When the job will run
- $hook : string
-
The hook to trigger
- $args : array<string|int, mixed> = array()
-
Arguments to pass when the hook triggers
- $group : string = ''
-
The group to assign this job to
wc_schedule_recurring_action()
Schedule a recurring action
wc_schedule_recurring_action(int $timestamp, int $interval_in_seconds, string $hook[, array<string|int, mixed> $args = array() ][, string $group = '' ]) : string
Parameters
- $timestamp : int
-
When the first instance of the job will run
- $interval_in_seconds : int
-
How long to wait between runs
- $hook : string
-
The hook to trigger
- $args : array<string|int, mixed> = array()
-
Arguments to pass when the hook triggers
- $group : string = ''
-
The group to assign this job to
Tags
wc_schedule_cron_action()
Schedule an action that recurs on a cron-like schedule.
wc_schedule_cron_action(int $timestamp, string $schedule, string $hook[, array<string|int, mixed> $args = array() ][, string $group = '' ]) : string
Parameters
- $timestamp : int
-
The schedule will start on or after this time
- $schedule : string
-
A cron-link schedule string
- $hook : string
-
The hook to trigger
- $args : array<string|int, mixed> = array()
-
Arguments to pass when the hook triggers
- $group : string = ''
-
The group to assign this job to
Tags
wc_unschedule_action()
Cancel the next occurrence of a job.
wc_unschedule_action(string $hook[, array<string|int, mixed> $args = array() ][, string $group = '' ]) : mixed
Parameters
- $hook : string
-
The hook that the job will trigger
- $args : array<string|int, mixed> = array()
-
Args that would have been passed to the job
- $group : string = ''
Tags
wc_next_scheduled_action()
wc_next_scheduled_action(string $hook[, array<string|int, mixed> $args = NULL ][, string $group = '' ]) : int|bool
Parameters
- $hook : string
- $args : array<string|int, mixed> = NULL
- $group : string = ''
Tags
wc_get_scheduled_actions()
Find scheduled actions
wc_get_scheduled_actions([array<string|int, mixed> $args = array() ][, string $return_format = OBJECT ]) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed> = array()
-
Possible arguments, with their default values: 'hook' => '' - the name of the action that will be triggered 'args' => NULL - the args array that will be passed with the action 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' 'group' => '' - the group the action belongs to 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID 'per_page' => 5 - Number of results to return 'offset' => 0 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' 'order' => 'ASC'
- $return_format : string = OBJECT
-
OBJECT, ARRAY_A, or ids