WordPress.org

Ready to get started?Download WordPress

Forums

Problem with wp_schedule_single_event (2 posts)

  1. idealists
    Member
    Posted 6 years ago #

    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.

  2. idealists
    Member
    Posted 6 years ago #

    where post_date_gmt = gmdate("Y-m-d H:i:s",$some_timestmp);
    and $ID is the id past to the function by xmlrpc_publish_post action

Topic Closed

This topic has been closed to new replies.

About this Topic