[wp-trac] [WordPress Trac] #38905: REST API: Bring consistency to the `rest_insert_*` actions

WordPress Trac noreply at wordpress.org
Tue Nov 22 17:23:45 UTC 2016


#38905: REST API: Bring consistency to the `rest_insert_*` actions
--------------------------+--------------------------------------
 Reporter:  rachelbaker   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.7
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:  needs-patch dev-feedback
  Focuses:                |
--------------------------+--------------------------------------
 We are inconsistent on when we fire the `rest_insert_*` actions in the
 `create_item()` and `update_item()` methods.

 I see three possible options here:

 '''option A:'''
 Immediately after the `wp_insert_*()` or `wp_update_*()` function - before
 any meta or additional fields are processed.

 '''option B:'''
 After the `wp_insert_*()` or `wp_update_*()` function and meta or
 additional fields are processed - before the  response is prepared.

 '''option C:'''
 After the `wp_insert_*()` or `wp_update_*()` function and meta or
 additional fields are processed and the response is prepared - before the
 response is sent.


 In the endpoint controllers we tend to do a mixture of B or C.
 Personally, I would expect option A.

 Either way, we should be consistent here.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38905>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list