WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 21 | */ |
| 22 | function wp_schedule_single_event( $timestamp, $hook, $args = array()) { |
| 23 | // don't schedule a duplicate if there's already an identical event due in the next 10 minutes |
| 24 | $next = wp_next_scheduled($hook, $args); |
| 25 | if ( $next && $next <= $timestamp + 600 ) |
| 26 | return; |
| 27 | |
| 28 | $crons = _get_cron_array(); |
| 29 | $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args ); |
| 30 | $event = apply_filters('schedule_event', $event); |
| 31 | |
| 32 | // A plugin disallowed this event |
| 33 | if ( ! $event ) |
| 34 | return false; |
| 35 | |
| 36 | $key = md5(serialize($event->args)); |
| 37 | |
| 38 | $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args ); |
| 39 | uksort( $crons, "strnatcasecmp" ); |
| Line | Code |
| 62 | */ |
| 63 | function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) { |
| 64 | $crons = _get_cron_array(); |
| 65 | $schedules = wp_get_schedules(); |
| 66 | |
| 67 | if ( !isset( $schedules[$recurrence] ) ) |
| 68 | return false; |
| 69 | |
| 70 | $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] ); |
| 71 | $event = apply_filters('schedule_event', $event); |
| 72 | |
| 73 | // A plugin disallowed this event |
| 74 | if ( ! $event ) |
| 75 | return false; |
| 76 | |
| 77 | $key = md5(serialize($event->args)); |
| 78 | |
| 79 | $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval ); |
| 80 | uksort( $crons, "strnatcasecmp" ); |