Guest User

Untitled

a guest
Aug 12th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. add_action( 'wp', 'prefix_setup_schedule' );
  2.  
  3. /**
  4. * Em um gancho de ação inicial, verifica se ele está agendado - caso contrário, agende-o.
  5. */
  6. function prefix_setup_schedule() {
  7. if ( ! wp_next_scheduled( 'prefix_hourly_event' ) ) {
  8. wp_schedule_event( time(), 'hourly', 'prefix_hourly_event');
  9. }
  10. }
  11.  
  12. add_action( 'prefix_hourly_event', 'prefix_do_this_hourly' );
  13.  
  14. /**
  15. * No gancho de ação agendado, execute uma função.
  16. */
  17. function prefix_do_this_hourly() {
  18. wp_mail(
  19. 'Automatic mail',
  20. 'Hello, this is an automatically scheduled email from WordPress.'
  21. );
  22. }
Advertisement
Add Comment
Please, Sign In to add comment