Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp unschedule event


Unschedules a previously-scheduled cron job.

Note that you need to know the exact time of the next occurrence when scheduled hook was set to run, and the function arguments it was supposed to have, in order to unschedule it. All future occurrences are unscheduled by calling this function.


 <?php wp_unschedule_event$timestamp$hook$args ); ?> 


(integer) (required) Timestamp of the next occurrence for the scheduled hook to run. wp_next_scheduled() may be useful.
Default: None
(string) (required) Action hook originally provided, the execution of which will be unscheduled.
Default: None
(array) (optional) Arguments to pass to the hook's callback function. These arguments are used to uniquely identify the scheduled event, so they must be the same as those used when originally scheduling the event.
Default: array()

Return Value

This function does not return a value.



// Get the timestamp for the next event.
$timestamp = wp_next_scheduled( 'my_schedule_hook' );

// If this event was created with any special arguments, you need to get those too.
$original_args = array();

wp_unschedule_event( $timestamp, 'my_schedule_hook', $original_args );



Change Log

Since: 2.1.0

Source File

wp_unschedule_event() is located in wp-includes/cron.php


See also index of Function Reference and index of Template Tags.