[wp-trac] [WordPress Trac] #28774: Hooking into wp_ajax_upload_attachment

WordPress Trac noreply at wordpress.org
Mon Jul 7 15:20:26 UTC 2014


#28774: Hooking into wp_ajax_upload_attachment
-------------------------+-----------------------------
 Reporter:  jshreve      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 If you want to do something before/after an attachment has been uploaded -
 or replace the upload function entirely -- there doesn't seem to be a way
 to do that:

 For other `wp_ajax_* calls`, you can unhook them and then hook in your
 own. This doesn't work for `wp_ajax_upload_attachment` because it ends up
 getting called directly from async-upload.php.

 If we replace the direct call with another set of `do_action/add_action`
 (like admin-ajax has) you can now hook into upload like the other ajax
 actions.

 See the proposed patch.

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


More information about the wp-trac mailing list