Open ajulien-fr opened 8 years ago
@juavenel I would suggest you add it to the includes/class-my-plugin-activator.php
. But it depends where your mycronjob
is defined too I think.
Hi,
An old issue I know but recently had to use a daily job in a project and came up with the following example of how it could be done #495.
Mark
I recently had a need for CRON (wp_schedule_event) functionality in a plugin which I was developing (based on WP Plugin Boilerplate). I wrote a short tutorial which explains the procedure. I hope it's okay to share it here.
Regards, Blaz
Hi (I am beginner in the wordpress plugin creation),
I need to create a Cron Job in "my plugin". I am using this tutorial : http://wpguru.co.uk/2014/01/how-to-create-a-cron-job-in-wordpress-teach-your-plugin-to-do-something-automatically/
Where to put these two lines:
if( !wp_next_scheduled( 'mycronjob' ) ) { wp_schedule_event( time(), 'daily', 'mycronjob' ); }
In "function activate_my_plugin()" stored in "my-plugin.php" or in "public static function activate()" stored in "includes/class-my-plugin-activator.php" ?
Please