Posted By

screamwork on 06/30/10


Tagged

wordpress


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

zreedeecom


scheduled event in Wordpress


 / Published in: PHP
 

  1. if (!wp_next_scheduled('my_task_hook')) {
  2. wp_schedule_event( time(), 'hourly', 'my_task_hook' );
  3. }
  4.  
  5. add_action( 'my_task_hook', 'my_task_function' );
  6.  
  7. function my_task_function() {
  8. wp_mail('[email protected]', 'Automatic email', 'Hello, this is an automatically scheduled email from WordPress.');
  9. }

Report this snippet  

You need to login to post a comment.