How to setup an hourly CRON with a Must-Use Plugin?
-
So I know how to schedule a CRON event:
function setup_cron() { if (! wp_next_scheduled ( 'my_hourly_event' )) { wp_schedule_event(time(), 'hourly', 'my_hourly_event'); } } add_action('my_hourly_event', 'do_this_hourly'); function do_this_hourly() { // do something every hour }
And usually you would run this on plugin activation to avoid scheduling an event every time WordPress is initialized:
register_activation_hook(__FILE__, 'setup_cron');
But how would I setup this same type of CRON in a Must-Use plugin, which of course never fires an activation hook? How can I setup an hourly CRON once without a new event being scheduled every time my site is loaded?
Thank you!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to setup an hourly CRON with a Must-Use Plugin?’ is closed to new replies.