1

I'm searching through the web for any solutions that will allow me to create a post programatically with post status : Future (Scheduled Post).

I'm reading through wp_schedule_event WordPress function for creating cron jobs.

Thanks in advance.

  • 1
    I'm not sure about your context, but we dealt with scheduled posts a few days ago, and @birgire did an excellent job done. Have a look if it may answer you. :) – Mayeenul Islam Dec 27 '14 at 8:01
4

I found my answer while searching over other stackoverflow answers below is the code what I've added.

$postdate = date('Y-m-d H:i:s',strtotime('+20 minutes'));
$postdate_gmt = gmdate('Y-m-d H:i:s',strtotime($postdate));

$post = array(
    'post_date_gmt'  => $postdate_gmt,
    'post_date'  => $postdate,
    'edit_date' => 'true'
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.