[wp-hackers] Using WP cron from mu-plugins

John Blackbourn johnbillion+wp at gmail.com
Thu Aug 23 16:25:39 UTC 2012


On 23 August 2012 16:04, Harry Metcalfe <harry at dxw.com> wrote:
> We have a plugin in mu-plugins that needs to schedule a wp cron task. The
> recommended way to do this is from an activation hook, but (reasonably
> enough) mu-plugins don't have activation hooks.
>
> The only way around this that I can think of is to have something check if
> the task is scheduled, and if it's not, schedule it. But that means we have
> to check for the task on every request, which sucks.
>
> Does anyone know of a better way to do it?

You're better off running your install/upgrade routinse on the admin_init hook.
See http://lists.automattic.com/pipermail/wp-hackers/2011-December/041917.html

John


More information about the wp-hackers mailing list