Menu

## functions.php

### Table of Contents

as_schedule_single_action() : string
  Schedule an action to run one time
as_schedule_recurring_action() : string
  Schedule a recurring action
as_schedule_cron_action() : string
  Schedule an action that recurs on a cron-like schedule.
as_unschedule_action() : string
  Cancel the next occurrence of a scheduled action.
as_unschedule_all_actions() : mixed
  Cancel all occurrences of a scheduled action.
as_next_scheduled_action() : int|bool
as_get_scheduled_actions() : array<string|int, mixed>
  Find scheduled actions
as_get_datetime_object() : ActionScheduler_DateTime
  Helper function to create an instance of DateTime based on a given string and timezone. By default, will return the current date/time in the UTC timezone.

### Functions

#### as_schedule_single_action()

functions.php : 17

Schedule an action to run one time

`as_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

#### as_schedule_recurring_action()

functions.php : 32

Schedule a recurring action

`as_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

#### as_schedule_cron_action()

functions.php : 57

Schedule an action that recurs on a cron-like schedule.

`as_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

see
  http://en.wikipedia.org/wiki/Cron

  ┬ ┬ ┬ ┬ ┬ ┬ | | | | | | | | | | | + year [optional] | | | | +----- day of week (0 - 7) (Sunday=0 or 7) | | | +---------- month (1 - 12) | | +--------------- day of month (1 - 31) | +-------------------- hour (0 - 23) +------------------------- min (0 - 59)

#### as_unschedule_action()

functions.php : 77

Cancel the next occurrence of a scheduled action.

`as_unschedule_action(string $hook[, array<string|int, mixed> $args = array() ][, string $group = '' ]) : string`

While only the next instance of a recurring or cron action is unscheduled by this method, that will also prevent all future instances of that recurring or cron action from being run. Recurring and cron actions are scheduled in a sequence instead of all being scheduled at once. Each successive occurrence of a recurring action is scheduled only after the former action is run. If the next instance is never run, because it's unscheduled by this function, then the following instance will never be scheduled (or exist), which is effectively the same as being unscheduled by this method also.

##### 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 = ''

#### as_unschedule_all_actions()

functions.php : 101

Cancel all occurrences of a scheduled action.

`as_unschedule_all_actions(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 = ''

#### as_next_scheduled_action()

functions.php : 114
`as_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 = ''

#### as_get_scheduled_actions()

functions.php : 156

Find scheduled actions

`as_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

#### as_get_datetime_object()

functions.php : 200

Helper function to create an instance of DateTime based on a given string and timezone. By default, will return the current date/time in the UTC timezone.

`as_get_datetime_object([mixed $date_string = null ][, string $timezone = 'UTC' ]) : ActionScheduler_DateTime`

Needed because new DateTime() called without an explicit timezone will create a date/time in PHP's timezone, but we need to have assurance that a date/time uses the right timezone (which we almost always want to be UTC), which means we need to always include the timezone when instantiating datetimes rather than leaving it up to the PHP default.

##### Parameters

$date_string : mixed = null

  A date/time string. Valid formats are explained in http://php.net/manual/en/datetime.formats.php

$timezone : string = 'UTC'

  A timezone identifier, like UTC or Europe/Lisbon. The list of valid identifiers is available http://php.net/manual/en/timezones.php

## Search results