[wp-hackers] How to set up crons in WP?

Dion Hulse (dd32) wordpress at dd32.id.au
Sat Aug 22 09:02:25 UTC 2009


The cron jobs are kicked off by a HTTP request.

WordPress has 2 methods, 1, is that it makes a HTTP request to itself at  
the end of a page view, and doesnt bother looking for any return data from  
the site, Thats the way its done in 99% of cases.

The other methods are a "Ajax" request made in the footer or something  
similar.. I think you need to add define('ALTERNATE_WP_CRON', true); for  
that method though..  I'm not really the best person to explain that one,  
but its rarely used.

You can set up a Crontab job to  call http://site.com/wp-cron.php if you  
wish, But its generally not needed.. the inbuilt cron system has been  
around since 2.0 or so i think.

On Sat, 22 Aug 2009 18:58:57 +1000, Eric Marden <wp at xentek.net> wrote:

> On Aug 21, 2009, at 9:20 AM, Otto wrote:
>
>> Cron doesn't call functions, it triggers action hooks. You need to tie
>> your action hook to your function.
>>
>> wp_schedule_event(time(), 'hourly', 'my_action_hook');
>> add_action('my_action_hook','my_function');
>> function my_function() ...
>
>
> Since we're on the topic, one thing that never made sense to me is how
> the whole wp-cron system is triggered since there aren't any
> instructions to have it actually triggered by an entry in crontab. How
> does wordpress know to run the scheduled jobs?
>
>
> - Eric Marden
> __________________________________
> http://xentek.net/code/wordpress/
>
>
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


-- 
Cheers,
Dion Hulse - dd32
--
Email: wordpress at dd32.id.au
Online: http://dd32.id.au/
WordPress QI: http://wpquickinstall.com/


More information about the wp-hackers mailing list