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

WordPress Trac noreply at wordpress.org
Fri Apr 6 05:48:56 UTC 2018


#43316: REST API: Support autosaves
-------------------------------------------------+-------------------------
 Reporter:  kraftbj                              |       Owner:  rmccue
     Type:  enhancement                          |      Status:  assigned
 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):

 Replying to [comment:67 rmccue]:
 > > Hm, `wp_save_post_revision()` doesn't wipe autosave revisions. It has
 some logic to keep a max number of revisions if they are limited by a
 plugin. The default is `-1` (unlimited). Also note that this logic
 specifically bypasses (keeps) autosave revisions, even when they are over
 the max.
 >
 > Ah, you're right, I'd misread the code there.

 The code that ''actually'' does this is in `edit-form-advanced.php` when
 the editor checks for autosaves. I guess this adds an extra step to the
 process too:

 * User opens the editor
   * Editor checks current autosaves: `GET
 /wp/v2/posts/{id}/revisions?revision_type=autosave`
     * If any autosaves exist newer than the last save, display restore
 button
     * If any other autosaves exist, delete them
   * Editor creates a new autosave: `POST
 /wp/v2/posts/{id}/revisions?revision_type=autosave`

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


More information about the wp-trac mailing list