Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#19715 closed defect (bug) (duplicate)

Can't Edit Draft Posting Date, using XML-RPC

Reported by: jmartindf's profile 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.

  1. Create a new post (using the web interface)
  2. Save Draft, from the web interface (don’t change the date/time at all, leave it at the default of Publish Immediately)
  3. Open post (using Mars Edit)
  4. Change publish date (using Post -> Edit Date)
  5. Change status to Published
  6. 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.

Attachments (1)

edit_date.patch (1.5 KB) - added by jmartindf 13 years ago.
Make the XML-RPC interface send the edit_date flag.

Download all attachments as: .zip

Change History (5)

@jmartindf
13 years ago

Make the XML-RPC interface send the edit_date flag.

#1 @nprasath002
13 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate #16985

#2 @nprasath002
13 years ago

This already reported please upload the patch there

#3 @helenyhou
13 years ago

  • Milestone Awaiting Review deleted

#4 @redsweater
13 years ago

  • Cc jalkut@… added
Note: See TracTickets for help on using tickets.