Changes between Initial Version and Version 1 of Ticket #47872, comment 32
- Timestamp:
- 10/23/2019 01:52:25 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #47872, comment 32
initial v1 4 4 For me, what differentiates new uploads from existing attachments: 5 5 - `wp_insert_attachment()` is called before, so the hook `add_attachment` is fired. 6 - Or, the hook `wp_ajax_media _create_image_subsizes` is fired.6 - Or, the hook `wp_ajax_media-create-image-subsizes` is fired. 7 7 In both cases we (as in "third party plugins", not WP core) can use the fired hook to store the attachment ID, and use it later in the new hook for comparison. It's a bit tricky, not clean, but it works (at least for `add_attachment` so far). This is actually [https://github.com/wp-media/imagify-plugin/blob/master/inc/classes/class-imagify-auto-optimization.php what I do in Imagify]. 8 8