Documentation

CronInterval : string
in package

Closed catalog of custom WP-Cron recurrences the adapter offers.

Replaces the old magic-string schedule keys: a typo now fails at compile time instead of silently scheduling nothing. Each case owns its interval length, its translatable label, and the timestamp of its next run, so the registrar never branches on an untyped string. The bare case value is the recurrence suffix; self::scheduleKey() prefixes it with the host component so two plugins in the same request never collide on a shared cron_schedules slot.

Table of Contents

Cases

DailyMorning  = 'daily_morning'
EveryMinute  = 'every_minute'
FifteenMinutes  = 'fifteen_minutes'
FiveMinutes  = 'five_minutes'
Hourly  = 'hourly'
ThirtyMinutes  = 'thirty_minutes'
TwiceDaily  = 'twice_daily'

Methods

label()  : string
Human-readable display label, routed through the host {@see TranslatorInterface} so the schedule name is localisable instead of hardcoded English.
nextRun()  : int
UNIX timestamp of the first run WordPress should schedule.
scheduleKey()  : string
WordPress schedule key: the host component name joined to the case value, e.g. `my-plugin_hourly`. Keeps each component's intervals in their own namespace on the shared `cron_schedules` filter.
seconds()  : int
Interval length in seconds, as WordPress expects on the `cron_schedules` filter.
nextMorning()  : int
Next 06:00 boundary: today's if still ahead, otherwise tomorrow's.

Cases

Methods

label()

Human-readable display label, routed through the host {@see TranslatorInterface} so the schedule name is localisable instead of hardcoded English.

public label(TranslatorInterface $translator) : string
Parameters
$translator : TranslatorInterface
Return values
string

nextRun()

UNIX timestamp of the first run WordPress should schedule.

public nextRun() : int

Interval cases round up to the next clock boundary (a five-minute event fires at the next :00/:05/:10…); self::DailyMorning fires at the next 06:00. No untyped default arm — the type guarantees the branch.

Return values
int

scheduleKey()

WordPress schedule key: the host component name joined to the case value, e.g. `my-plugin_hourly`. Keeps each component's intervals in their own namespace on the shared `cron_schedules` filter.

public scheduleKey(string $component) : string
Parameters
$component : string
Return values
string

seconds()

Interval length in seconds, as WordPress expects on the `cron_schedules` filter.

public seconds() : int
Return values
int

nextMorning()

Next 06:00 boundary: today's if still ahead, otherwise tomorrow's.

private nextMorning(int $now) : int
Parameters
$now : int
Return values
int
On this page

Search results