admin管理员组文章数量:1130349
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.
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.
Share Improve this question asked Dec 27, 2014 at 6:22 Ravi SoniRavi Soni 6971 gold badge7 silver badges17 bronze badges 1- 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 Commented Dec 27, 2014 at 8:01
1 Answer
Reset to default 7I 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'
);
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.
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.
Share Improve this question asked Dec 27, 2014 at 6:22 Ravi SoniRavi Soni 6971 gold badge7 silver badges17 bronze badges 1- 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 Commented Dec 27, 2014 at 8:01
1 Answer
Reset to default 7I 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'
);
本文标签: Any way to create scheduled post programatically
版权声明:本文标题:Any way to create scheduled post programatically? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749199576a2331569.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论