A WordPress-centric search engine for devs and theme authors



wp_get_schedule ›

Since2.1.0
Deprecatedn/a
wp_get_schedule ( $hook, $args = array() )
Parameters: (2)
  • (string) $hook Action hook to identify the event.
    Required: Yes
  • (array) $args Optional. Arguments passed to the event's callback function.
    Required: No
    Default: array()
See:
Returns:
  • (string|false) False, if no schedule. Schedule name on success.
Defined at:
Codex:

Retrieve the recurrence schedule for an event.



Source

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;
}