I'm having a problem writing a plugin.
The plugin calls the following 2 wordpress functions:
...code before...
wp_clear_scheduled_hook( 'publish_future_post', $ID );
wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', array($ID));
...code after...
SOMETIMES the above 2 lines of code DOESN'T work. When I check the options table and the cron, the post with an id of ID doesn't appear in the cron row.
HOWEVER, I know the ...code after... is being called EVERY TIME without fail, even though the wp_schedule_single_event function seems to be failing.
I have no idea what is wrong and why the wp_schedule_single_event fails "randomly" however parsing control back to the rest of the function.
Please help somebody.