[wp-hackers] How to set up crons in WP?
Otto
otto at ottodestruct.com
Fri Aug 21 13:20:24 UTC 2009
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() ...
-Otto
On Fri, Aug 21, 2009 at 7:57 AM, rajasekharan<websweetweb at gmail.com> wrote:
> Hi everyone,
>
> I am trying to set up a cron job in wordpress to call a function called
> "wpr_cronjob" every hour in my wordpress plugin. So I registered a
> activation hook and in the hook I call the following function:
>
> wp_schedule_event(time(), 'hourly', 'wpr_cronjob');
>
> But I the function is not getting called because every time the function is
> called, I will receive an email (which I am not getting). I have set up a
> cronjob on my linux server to run wp-cron.php every 5 minutes and the
> function is still not getting called. Could you please tell me what I am
> doing wrong?
>
> Thanks in advance,
>
> Raj Sekharan.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list