-
-
Notifications
You must be signed in to change notification settings - Fork 0
Cronjob Helper
Mattias edited this page Aug 1, 2021
·
2 revisions
The add function simplifies registering a cronjob.
add(array $args)
-
$args (array) (Required)
- hook (string) (Required)
- args (array) (Required)
- timestamp (integer) (Required)
- recurrence (string) (Required)
- wp_error (boolean) (Required)
cronjob()->add([
'hook' => 'test_cron',
'args' => [],
'timestamp' => time(),
'recurrence' => 'iroh_every_thirty_min',
'wp_error' => false,
]);
The add_recurrence function helps you write a new interval for any cron task.
add_recurrence(array $args)
-
$arg (array) (Required)
- key (string) (Required)
- interval (integer) (Required)
- display (string) (Required)
cronjob()->add_recurrence([
'key' => 'iroh_every_thirty_min',
'interval' => 1800,
'display' => __('Every 30 Minutes', APP_DOMAIN),
]);
The registry function returns an array of registerd tasks and schedules.
registry()
- None
dump( cronjob()->registry() );