wp_get_schedule( string $hook, array $args = array() )
Retrieves the name of the recurrence schedule for an event.
Description
See also
wp_get_schedules(): for available schedules.
Parameters
- $hook
-
(Required) Action hook to identify the event.
- $args
-
(Optional) Arguments passed to the event's callback function.<br>
Default value: array()
Return
(string|false) Schedule name on success, false if no schedule.
Source
File: wp-includes/cron.php
function wp_get_schedule($hook, $args = array()) {
$crons = _get_cron_array();
$key = md5(serialize($args));
if ( empty($crons) )
return false;
foreach ( $crons as $timestamp => $cron ) {
if ( isset( $cron[$hook][$key] ) )
return $cron[$hook][$key]['schedule'];
}
return false;
}
Changelog
Version | Description |
---|---|
5.1.0 | 'get_schedule' filter added. |
2.1.0 | Introduced. |