Support » Everything else WordPress » Cron help in codex?

  • Greets:

    Just wondering if there was any write ups within codex or elsewhere about how to use wordpress’s built in cron settings. I didn’t find anything when I did a search except for Skippy’s plugin.

    Like how to add stuff in, etc.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    I also like to know whether there is any documentation available for the build-in cron functionality of wordpress.

    Did you find anything?

    Nope. Came back to ask again actually.

    There’s no actual documentation been written yet, but it’s pretty simple. Just have a look through the functions in wp-includes/cron.php. You don’t need to know the function details, the names are fairly obvious.
    These are the only functions you’ll ever need to use:

    wp_schedule_single_event() – Schedules a one time job
    wp_schedule_event() – Schedules a recurring job
    wp_unschedule_event() – Remove a particular job
    wp_clear_scheduled_hook() – Remove a job and any other job calling that same hook (easiest way to remove a job)
    wp_next_scheduled() – Finds out when a particular job is next scheduled to run

    There’s others, but you probably won’t need to use them.

    Basically, these let you define jobs. At the time that the job is scheduled to run, it will call an action hook and arguments that you specify. You add your actions to that hook, which makes it call your functions, which run and do whatever you want them to do.

    The only thing you have to be careful of is to delete your jobs when you’re not using them. So if you write a plugin, make sure to include a deactivation trigger that will remove your jobs using wp_clear_scheduled_hook(). Otherwise they hang around and leave a mess.

    One time jobs clean themselves up. Recurring jobs get rescheduled after every run. So an hourly job, for example, will have the next entry in there and when it runs, that entry gets removed and another one gets scheduled for an hour later. That sort of thing. This happens automatically, you don’t have to mess with it.

    I need a cronjob help, I´m bad in computers and English, who like to help me anyway.

    BEN thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cron help in codex?’ is closed to new replies.