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
29      $crons = _get_cron_array();
30      $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args );
31      /**
32       * Filter a single event before it is scheduled.
33       *
34       * @since 3.1.0
35       *
36       * @param object $event An object containing an event's data.
37       */
38      $event = apply_filters( 'schedule_event', $event );
39
40      // A plugin disallowed this event
41      if ( ! $event )
42           return false;
43
44      $key = md5(serialize($event->args));
45
46      $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args );
47      uksort( $crons, "strnatcasecmp" );
 
Line Code
71 function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
72      $crons = _get_cron_array();
73      $schedules = wp_get_schedules();
74
75      if ( !isset( $schedules[$recurrence] ) )
76           return false;
77
78      $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
79      /** This filter is documented in wp-includes/cron.php */
80      $event = apply_filters( 'schedule_event', $event );
81
82      // A plugin disallowed this event
83      if ( ! $event )
84           return false;
85
86      $key = md5(serialize($event->args));
87
88      $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval );
89      uksort( $crons, "strnatcasecmp" );