The default supported recurrences are 'hourly', 'twicedaily', 'daily', and 'weekly'.A plugin may add more by hooking into the 'cron_schedules' filter.The filter accepts an array of arrays. The outer array has a key that is the name of the schedule, for example 'monthly'. The value is an array with two keys, one is 'interval' and the other is 'display'. The 'interval' is a number in seconds of when the cron job should run.So for 'hourly' the time is HOUR_IN_SECONDS (60 * 60 or 3600). For 'monthly', the value would be MONTH_IN_SECONDS (30 * 24 * 60 * 60 or 2592000). The 'display' is the description. For the 'monthly' key, the 'display' would be __( 'Once Monthly' ). For your plugin, you will be passed an array. You can add your schedule by doing the following: // Filter parameter variable name is 'array'.
$array['monthly'] = array(
'interval' => MONTH_IN_SECONDS,
'display' => __( 'Once Monthly' )
);
Return
array
The array of cron schedules keyed by the schedule name.
...$0array
Cron schedule information.
$intervalint
The schedule interval in seconds.
$displaystring
The schedule display name.
Hooks fired · 1
One hook fires while wp_get_schedules() runs, in this order:
Signature, return type and hooks compared across 5 parsed releases.
5.4.0
The 'weekly' schedule was added.from the docblock
2.1.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/cron.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.