I have created the following action:
add_action( 'test_action', 'test_action' );
function test_action() {
error_log( 'test_action' );
}
And am calling it like this:
error_log( 'send_test_email_in_background:START' );
wp_schedule_single_event( time(), 'test_action' );
error_log( 'send_test_email_in_background:END' );
What I receive in the apache error log file is this:
[17-Sep-2015 11:09:35 UTC] send_test_email_in_background:START
[17-Sep-2015 11:09:35 UTC] send_test_email_in_background:END
This works exactly the same in development on my Windows PC (running WAMP) than it is on Production (running Linux in AWS). Also, if I schedule the single event 5 minutes in the future (time() + 300) it shows in my "Debug Bar Cron" plugin as being available to run in 5 minutes time and it appears to run just fine. So it appears that the CRON jobs are being created but for some reason they are not actually calling the action when running? Has anyone else had this problem or have an insight into it?