[wp-trac] [WordPress Trac] #22686: wp.getRevisions returns auto-drafts

WordPress Trac noreply at wordpress.org
Sun Dec 2 22:19:11 UTC 2012


#22686: wp.getRevisions returns auto-drafts
--------------------------+------------------------------
 Reporter:  maxcutler     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  XML-RPC       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------

Comment (by nacin):

 Hmm. Not sure I understand. auto-drafts are the actual post object before
 it is converted to a regular draft (or pending post, or published post).

 Let's say you have post 5, and want revisions for it.
 wp_get_post_revisions(), which is used by wp.getRevisions, returns all
 items with post_type = 'revision' and post_parent = 5. We then filter out
 autosaves, as autosaves are special kind of revision.

 An auto-draft would look like this: ID = 5, post_type = 'post',
 post_status = 'auto-draft'.

 Revisions all get a status of 'inherit' (thus inheriting its parent
 status), but it's not possible to create a revision against auto-draft,
 since saving the post to create a revision by definition will promote
 'auto-draft' to 'draft'.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22686#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list