使用从前端提交帖子时,定义帖子日期的正确方法是什么wp_insert_post (Trac)?
我的代码片段现在正在使用mysql时间发布。。。
if (isset ($_POST[\'date\'])) {
$postdate = $_POST[\'Y-m-d\'];
}
else {
$postdate = $_POST[\'2011-12-21\'];
}
// ADD THE FORM INPUT TO $new_post ARRAY
$new_post = array(
\'post_title\' => $title,
\'post_content\' => $description,
\'post_date\' => $postdate,
\'post_status\' => \'publish\',
\'post_parent\' => $parent_id,
\'post_author\' => get_current_user_id(),
);
//SAVE THE POST
$pid = wp_insert_post($new_post);