Documentation

JobSchedulerInterface

Contract for enqueuing one-off async jobs on a WordPress host.

The WordPress counterpart of Moodle's adhoc-task seam: a job is a hook name plus positional arguments, executed out-of-band by whichever queue backend the driver wraps. Consumers register a listener on the hook (add_action($hook, …)) and enqueue through this port, staying agnostic of the backend — Action Scheduler when present (ActionSchedulerDriver), plain WP-Cron otherwise (WpCronDriver).

Table of Contents

Methods

enqueue()  : bool
Enqueue a one-off job for as-soon-as-possible async execution.

Methods

enqueue()

Enqueue a one-off job for as-soon-as-possible async execution.

public enqueue(string $hook[, array<int, mixed> $args = [] ]) : bool
Parameters
$hook : string

the action hook the job fires

$args : array<int, mixed> = []

positional arguments passed to the hook listener; must be distinct per job under WP-Cron (identical hook+args pairs within ten minutes are suppressed)

Return values
bool —

true when the job was accepted by the backend

On this page

Search results