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