[wp-hackers] RE: WordPress 2.1 Cron Examples
Lester Chan
gamerz84 at hotmail.com
Mon Jan 22 00:43:23 GMT 2007
I left it overnight and it still does not work. With Regards, Lester 'GaMerZ' Chanhttp://www.lesterchan.netOn 1/21/07, Lester Chan <gamerz84 at hotmail.com> wrote:
> Hi Guys,
> I intending to use the inbuilt cron feature of wordpress 2.1 but i can't find any examples of it.
>
> I tried the following code, but it will not work. Any ideas?
Could the problem be that you're scheduling the first event to be
right now (using time() ), instead of in the future? It may be that
by the time the event gets scheduled, it's already in the past, so you
would need to wait an hour for the next interval to occur.
From: gamerz84 at hotmail.comTo: wp-hackers at lists.automattic.comSubject: WordPress 2.1 Cron ExamplesDate: Mon, 22 Jan 2007 03:38:32 +0800
Hi Guys,I intending to use the inbuilt cron feature of wordpress 2.1 but i can't find any examples of it. I tried the following code, but it will not work. Any ideas? add_action('test', 'test');function test() { global $wpdb; $wpdb->query("INSERT INTO test VALUES(".current_time('timestamp').")");}//wp_clear_scheduled_hook('test');if (!wp_next_scheduled('test')) { wp_schedule_event(time(), 'hourly', 'test');}Thanks =DWith Regards, Lester 'GaMerZ' Chanhttp://www.lesterchan.net
Express yourself instantly with Windows Live Messenger! Windows Live Messenger!
_________________________________________________________________
Try Live.com - your fast, personalized homepage with all the things you care about in one place.
http://www.live.com/getstarted
More information about the wp-hackers
mailing list