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

Andrew Ozz admin at laptoptips.ca
Sat Aug 22 09:25:35 UTC 2009


Dion Hulse (dd32) wrote:
> 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.

Yes, tried ajax but it brought some problems. 
define('ALTERNATE_WP_CRON', true); would try to redirect the browser to 
the same URL and then run wp-cron from the old process so it doesn't 
slow down the visitor. This works properly in most cases except with 
some web servers when they compress output.

> 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.

If the default wp-cron doesn't work properly you can use any means to 
call wp-cron.php from the command line: PHP CLI, cURL, Wget, even Lynx.


More information about the wp-hackers mailing list