[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves

WordPress Trac noreply at wordpress.org
Tue Apr 3 05:50:34 UTC 2018


#43316: REST API: Support autosaves
-------------------------------------------------+-------------------------
 Reporter:  kraftbj                              |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  5.0
Component:  REST API                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |     Focuses:  rest-api
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by rmccue):

 > I'm not certain on the actual implementation of autosaves, but it seems
 like they use revisions under the hood?

 I've been digging into the implementation here; autosaves do indeed create
 revisions. They are identified by the slug being `{id}-autosave`.
 `wp_get_post_autosave()` and `wp_create_post_autosave()` appear to be
 where the one-autosave-per-user concept is handled.

 In the REST API, I would map these to a query instead. Something like
 `/revisions?autosave=true&author=1` would get the autosave for the current
 user if one exists, and you could use the revision's ID to update that
 autosave.

 In one sense, this does expose some of the internals of how autosaves
 work, but I don't think that's a bad thing. I had no real idea how
 autosaves worked internally, and my previous thinking still aligned with
 this; knowing that they really are revisions internally I think solidifies
 the revision-based design for me.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43316#comment:60>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list