[wp-trac] [WordPress Trac] #19715: Can't Edit Draft Posting Date, using XML-RPC
WordPress Trac
wp-trac at lists.automattic.com
Tue Jan 3 00:52:48 UTC 2012
#19715: Can't Edit Draft Posting Date, using XML-RPC
--------------------------+-----------------------------
Reporter: jmartindf | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: XML-RPC | Version: 3.2.1
Severity: normal | Keywords: has-patch
--------------------------+-----------------------------
I’ve been seeing a weird workflow between !MarsEdit and Wordpress that’s
been causing problems when I attempt to schedule future posts. A few days
ago, I nailed down the exact workflow and the cause.
The general workflow is when taking a draft post and publishing it, from
!MarsEdit, with a future date/time. Here’s the specific workflow that
causes problems.
1. Create a new post (using the web interface)
1. Save Draft, from the web interface (don’t change the date/time at all,
leave it at the default of Publish Immediately)
1. Open post (using Mars Edit)
1. Change publish date (using Post -> Edit Date)
1. Change status to Published
1. Send to server
After sending the post to the server, you’ll have a new post that was
published immediately, not a new post scheduled for a future date.
If you create the new post using !MarsEdit (instead of the Wordpress web
interface), you don’t have this problem. If you publish the post using the
web interface (instead of !MarsEdit), you also don’t have this problem.
I tracked the problem down to wp_update_post in `wp-includes/post.php`.
That function clears the `post_date` and `post_date_gmt` fields (from the
XML-RPC interface) if all of the following are true:
* the post is a draft
* the `post_date_gmt` is '0000-00-00 00:00:00'
* there is no `edit_date` variable defined, in $postarr.
I experimented and determined that when draft posts are created from
Wordpress’s web interface, the `post_date_gmt` is always set to
'0000-00-00 00:00:00'. Because `wp-includes/class-wp-xmlrpc-server.php`
never does anything to set `edit_date` in `$postarr`, it's not possible to
change the post date until after the post has been published.
I created a patch to `wp-includes/class-wp-xmlrpc-server.php`, to set
edit_date when the XML-RPC client sends a post date. I'm not sure if
that's the best way to fix this problem, but it works for me.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19715>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list