[wp-trac] [WordPress Trac] #45269: REST API: `rest_insert_attachment` and `rest_after_insert_attachment` actions fire twice on update.

WordPress Trac noreply at wordpress.org
Sat Nov 3 04:28:00 UTC 2018


#45269: REST API: `rest_insert_attachment` and `rest_after_insert_attachment`
actions fire twice on update.
---------------------------+--------------------------------------
 Reporter:  peterwilsoncc  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  REST API       |    Version:  5.0
 Severity:  normal         |   Keywords:  has-patch has-unit-tests
  Focuses:                 |
---------------------------+--------------------------------------
 As `\WP_REST_Attachments_Controller::update_item()` calls
 `\WP_REST_Posts_Controller::update_item()`, this causes the
 `rest_insert_attachment` and `rest_after_insert_attachment` hooks to be
 fired twice on update requests, once in each controller class.

 Creating as item isn't affected as the attachment controller does not call
 the parent class.

 `rest_after_insert_attachment` is new for version 5.0
 `rest_insert_attachment` is from a previous version of WP

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


More information about the wp-trac mailing list