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

WordPress Trac noreply at wordpress.org
Tue Nov 22 19:13:47 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                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+--------------------
Changes (by rachelbaker):

 * keywords:  needs-patch dev-feedback => dev-feedback has-patch


Comment:

 In [attachment:38905.diff] I move the `rest_insert_*` actions to fire
 after the related object is updated or inserted.  Thge patch also includes
 some shuffling and clean-up as well including:

 - Ensure we are passing the most current `$post` and `$user` objects to
 the `update_additional_fields_for_object()` callbacks.
 - Changes the function signature of`handle_status_param()` in the comments
 controller to accept just the comment_id as the 2nd parameter, instead of
 a full WP_Comment object. Only the comment_id is needed in the method, and
 I wanted to avoid adding another `get_comment()` function. (not married to
 this, just seemed like the most logical approach)
 - Renames some variables in the `create_item()` method of the Posts
 controller to be more explicit.
 - Minor fixes/clarifications to the `rest_insert_*` hook docs

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


More information about the wp-trac mailing list