Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_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
82       *
83       *     @type string       $hook      Action hook to execute when the event is run.
84       *     @type int          $timestamp Unix timestamp (UTC) for when to next run the event.
85       *     @type string|false $schedule  How often the event should subsequently recur.
86       *     @type array        $args      Array containing each separate argument to pass to the hook's callback function.
87       *     @type int          $interval  The interval time in seconds for the schedule. Only present for recurring events.
88       * }
89       * @param bool               $wp_error Whether to return a WP_Error on failure.
90       */
91      $pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error );
92
93      if ( null !== $pre ) {
94           if ( $wp_error && false === $pre ) {
95                return new WP_Error(
96                     'pre_schedule_event_false',
97                     __( 'A plugin prevented the event from being scheduled.' )
98                );
99           }
100
 
Line Code
261      $event = (object) array(
262           'hook'      => $hook,
263           'timestamp' => $timestamp,
264           'schedule'  => $recurrence,
265           'args'      => $args,
266           'interval'  => $schedules[ $recurrence ]['interval'],
267      );
268
269      /** This filter is documented in wp-includes/cron.php */
270      $pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error );
271
272      if ( null !== $pre ) {
273           if ( $wp_error && false === $pre ) {
274                return new WP_Error(
275                     'pre_schedule_event_false',
276                     __( 'A plugin prevented the event from being scheduled.' )
277                );
278           }
279