Scheduling a cron job from a function that is ran outside functions.php?

Question

I have a very simple function and hook registration in my functions.php, like this:

function do_this_thingy(){
   // I am sending myself some simple admin report mails, tested & works
}
add_action( 'mail_event_hook', 'do_this_thingy');

Then, in a page template I have a row:

wp_schedule_single_event( time() + 600, 'mail_event_hook' );
// expected: to receive message in ten minutes time. Result: no message :(

What might be going wrong?

0
Jussi 3 years 2019-12-02T09:24:54-05:00 0 Answers 67 views 0

Leave an answer

Browse
Browse