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