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

WordPress Trac noreply at wordpress.org
Thu Feb 22 16:01:05 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  |     Focuses:  rest-api
-------------------------------------+-----------------------

Comment (by adamsilverstein):

 @azaozz I did some local testing and this seems to work well. I tested in
 the console after opening a page with wp-api loaded:


 {{{
 var post = new wp.api.models.Post();
 post.set( 'title', 'autosave test' );
 post.save();
 post.set( 'status', 'publish' );
 post.save();
 post.set( 'title', 'updated autosave test' );
 post.save( { is_autosave: true } );
 }}}

 I then logged in as a different user and created a new autosave as that
 user:

 {{{
 var post = new wp.api.models.Post();
 post.set('id',[previous_id]);
 post.fetch();
 post.save( { is_autosave: true } );
 }}}

 At this point, checking the database, the rows look as I expect them to:

 [[Image(https://cl.ly/0m3I2H3H0k2j/Image%202018-02-22%20at%2010.58.00%20AM.png)]]

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


More information about the wp-trac mailing list