Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: schedule_event

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
46       * @param stdClass $event {
47       *     An object containing an event's data.
48       *
49       *     @type string       $hook      Action hook to execute when event is run.
50       *     @type int          $timestamp Unix timestamp (UTC) for when to run the event.
51       *     @type string|false $schedule  How often the event should recur. See `wp_get_schedules()`.
52       *     @type array        $args      Arguments to pass to the hook's callback function.
53       * }
54       */
55      $event = apply_filters( 'schedule_event', $event );
56
57      // A plugin disallowed this event
58      if ( ! $event )
59           return false;
60
61      $key = md5(serialize($event->args));
62
63      $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args );
64      uksort( $crons, "strnatcasecmp" );
 
Line Code
93
94      $crons = _get_cron_array();
95      $schedules = wp_get_schedules();
96
97      if ( !isset( $schedules[$recurrence] ) )
98           return false;
99
100      $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
101      /** This filter is documented in wp-includes/cron.php */
102      $event = apply_filters( 'schedule_event', $event );
103
104      // A plugin disallowed this event
105      if ( ! $event )
106           return false;
107
108      $key = md5(serialize($event->args));
109
110      $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval );
111      uksort( $crons, "strnatcasecmp" );