#19715 closed defect (bug) (duplicate)
Can't Edit Draft Posting Date, using XML-RPC
Reported by: | jmartindf | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.2.1 |
Component: | XML-RPC | Keywords: | has-patch |
Focuses: | Cc: |
Description
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.
- Create a new post (using the web interface)
- Save Draft, from the web interface (don’t change the date/time at all, leave it at the default of Publish Immediately)
- Open post (using Mars Edit)
- Change publish date (using Post -> Edit Date)
- Change status to Published
- 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.
Make the XML-RPC interface send the edit_date flag.