wp_get_schedule
Retrieve the recurrence schedule for an event.
Description
Returns (string|false)
False, if no schedule. Schedule name on success.
Parameters (2)
- 0. $hook (string)
- Action hook to identify the event.
- 1. $args — Optional. (array) =>
array()
- Arguments passed to the event's callback function.
Usage
if ( !function_exists( 'wp_get_schedule' ) ) { require_once ABSPATH . WPINC . '/cron.php'; } // Action hook to identify the event. $hook = ''; // Optional. Arguments passed to the event's callback function. $args = array(); // NOTICE! Understand what this does before running. $result = wp_get_schedule($hook, $args);
Defined (1)
The function is defined in the following location(s).
- /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;
- }