[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves
WordPress Trac
noreply at wordpress.org
Fri Apr 6 13:42:23 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 azaozz):
Replying to [comment:69 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`
Hm, no. The code in `edit-form-advanced.php` repeats the same logic as in
`wp_create_post_autosave()`
https://core.trac.wordpress.org/browser/tags/4.9.5/src/wp-
admin/includes/post.php#L1687. It deletes the latest autosave only when
the autosaved "fields" match the latest post. It also doesn't look for
previous autosave revisions by other authors.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43316#comment:72>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list