Ready to get started?Download WordPress


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

Function Reference/wp schedule single event


Schedules a hook which will be executed once by the Wordpress actions core at a time which you specify. The action will fire off when someone visits your WordPress site, if the schedule time has passed.


 <?php wp_schedule_single_event(time(), 'my_schedule_hook'); ?> 


Schedule an event one hour from now

function do_this_in_an_hour() {
// do something

// put this line inside a function, 
// presumably in response to something the user does
// otherwise it will schedule a new event on every page visit

wp_schedule_single_event(time()+3600, 'my_new_event');

// time()+3600 = one hour from now.


(integer) (required) The time you want the event to occur. This must be in a UNIX timestamp format.
Default: None
(string) (required) The name of an action hook to execute.
Default: None
(array) (optional) Arguments to pass to the hook function(s)
Default: None