使用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);
$postdate = date('2010-02-23 18:57:33');
实际上会使输入框停止运行,虽然这可能只是Chrome中的一个错误……