$content = array(
'post_title' => $title,
'post_content' => $body,
'post_status' => 'publish',
'post_date' => $pub_date //What's the proper format for the date here?
)
$params = array(0,$this->settings['username'],$this->settings['password'],$content);
$request = xmlrpc_encode_request('wp.newPost',$params);
$this->Curl->post($this->controller->rpc_url,$request);
我已经为 post_date 格式尝试了许多不同的变体,但都没有奏效。以下是我已经尝试过的所有组合,但它们都不起作用:
1) $pub_date = date('Y-m-d H:i:s', time());
2) $pub_date = time();
3) $pub_date = new IXR_Date(time());
4) $pub_date = date('c',time());
5) $datetime = new DateTime('2010-12-30 23:21:46');
$pub_date = $datetime->format(DateTime::ISO8601);
似乎我测试了所有可能的解决方案,但每当我尝试包含 post_date 时它仍然不想发布。有人可以帮忙吗,我真的坚持这个。