I'm using wp_schedule_event() to add items to wp-cron but they seem to be constantly adding additional instances of the event every time the site is loaded or at least that is what this sql query leads me to believe http://docs.google.com/View?id=d6csj54_11cp8jdpfw
Code:
wp_schedule_event(time(), 'twicedaily', 'work_paid_listings');
wp_schedule_event(time(), 'daily', 'clean_spam_users');
Could this be because I'm using time() instead of a non changing integer?
You only ever schedule something for cron once, or once per blog if required. Once its set that's it. So if its a plugin you need to put it the initialisation block, and don't forget to remove it in the plugin deactivation block as well
will this work with MU plugins? I haven't seen any way to turn MU plugins on or off other than removing the files
If you're going to do it with a mu plugin then the best way would be to either use a blog option to make sure you only set it up once or use the wp_next_scheduled function to see if your job is scheduled for that blog and if not then schedule it
tim.moore
Member
Posted 14 years ago #
There's also WP-Crontrol, which I've found to be an excellent way to manage wp-cronjobs.