Php Wordpress-设置发布日期
我正试图通过XMLRPC将博客帖子的发布日期设置为Wordpress 我将以字符串形式发送数据:Php Wordpress-设置发布日期,php,wordpress,Php,Wordpress,我正试图通过XMLRPC将博客帖子的发布日期设置为Wordpress 我将以字符串形式发送数据: $pubdate = '2010-04-08 13:46:43'; 'post_date'=>$pubdate, “发布日期”是否正确 我还发现这篇文章与这个问题毫无关联: 有人能建议我如何将日期发布为:dateTime.iso8601你试过吗 $pubdate = date('c',strtotime('2010-04-08 13:46:43')); 要将日期发布为元素(假设您使用W
$pubdate = '2010-04-08 13:46:43';
'post_date'=>$pubdate,
“发布日期”是否正确
我还发现这篇文章与这个问题毫无关联:
有人能建议我如何将日期发布为:dateTime.iso8601
你试过吗
$pubdate = date('c',strtotime('2010-04-08 13:46:43'));
要将日期发布为
元素(假设您使用WordPress中的内置XML-RPC客户端,您希望将日期强制转换为IXR\U日期
对象)
// Convert the time to an integer value for parsing.
$pubdate = strtotime( '2010-04-08 13:46:43' );
// Convert the date to the right kind of object.
$pubdate = new IXR_Date( $pubdate );
现在,当您传递参数数组以发出请求时,传递'pub_date'=>$pubdate
将创建正确的XML元素
如果您想要完整的工作示例,请参阅类似问题以了解更多信息