Wordpress - setting post_date
I am trying to install post_date
Wordpress blog posts via XMLRPC.
I am sending data as a string:
$pubdate = '2010-04-08 13:46:43';
'post_date'=>$pubdate,
Appears 'post_date'
correctly?
I also found this post related to the issue: http://wordpress.org/support/topic/330597
Can anyone suggest how I posted the date as: dateTime.iso8601
source to share
Have you tried this?
$pubdate = date('c',strtotime('2010-04-08 13:46:43'));
source to share
To post a date as an item <dateTime.iso8601>
(assuming you are using the built-in XML-RPC client in WordPress, you want to specify the date as an object IXR_Date
.
// 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 );
Now, when you pass an array of arguments to a request, the pass 'pub_date' => $pubdate
will result in a valid XML element being generated.
See this other answer on a similar question for more information if you want a complete working example.
source to share