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?
Edit: Answers to questions:
- Is this on a local server? No, this is a live WP site of mine.
- How do I know that emails can be sent in the first place? The code that I use to send emails works perfectly if I simply run it from functions.php or another .php file on the server. I receive the email every time I try.
- Am I sure the CRON job fired? I have the plugin WP Crontrol and it shows no scheduled task / cron job. I assume thus that the answer is no.
- Are there PHP errors in the logs? I can take a look at this with debug logging enabled later today. Will update.