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

WordPress Trac noreply at wordpress.org
Wed Jun 20 14:04:41 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 aduth):

 Adding to comment:76 , it is not immediately obvious what fields this
 endpoint is capable of receiving, and in fact it varies by post status /
 authorship.

 For auto-drafts / drafts authored by the current user, the following
 fields are supported:

 - id
 - date
 - date_gmt
 - slug
 - status
 - password
 - title
 - content
 - author
 - excerpt
 - comment_status
 - ping_status

 Notably this excludes: featured_media, format, meta, sticky, template,
 categories, tags

 This was determined in the autosaves controller's use of
 `WP_REST_Posts_Controller::prepare_item_for_database`, which assigns only
 these fields.

 On the other hand, in all other circumstances only the following fields
 are supported:

 - id
 - title
 - content
 - excerpt

 This was determined in the use of `_wp_post_revision_fields` to intersect
 fields for `_wp_put_post_revision`.

 Given then the need to pass `status` with the payload as described in
 comment:76 , it is especially confusing since it is only respected for
 some, but not all requests (only those which are auto-draft/draft by
 current user).

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


More information about the wp-trac mailing list