$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);
I’ve tried many different variations for post_date format and none of them worked. Here are all the combinations that I’ve already tried and none of them are working:
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);
It seems like I tested every possible solution and it still doesn’t want to post whenever I try to include post_date. Could someone please help, I’m really stuck on this one.
- The topic ‘WordPress XMLRPC (wp.newPost) – Can't get post_date formatted right’ is closed to new replies.