I found it after trying with several hooks.
Use ‘init’ and check if $_FILES is empty, if not, do what you want to do.
Related Posts:
- Hook to get image filename when it is uploaded
- How can I add an image upload field directly to a custom write panel?
- Hook event for upload image in the menu
- Is there a better way to implement responsive images than what WordPress uses by default?
- What filter should I use to insert a button inside on Media>Add New
- Upload multiple images and insert them into custom html code
- Cleaning a filename after image sideloading a url that contains `%20`
- How to move an image in a plugin to the upload directory and make it as a media of wordpress?
- WordPress discards PNG file when uploading plugin file
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- Using “add_image_size” to register custom image sizes inside plugins not working
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Upload to a specific media folder created by FileBird Lite
- Standard location for plugin to save/cache files?
- Add a new tab to WordPress Plugin install Listing
- Changing Plugin Load Order
- Admin settings update updating every time home page is hit?
- Global Objects and Public Methods
- How should you hook a session_start() when authoring a plugin?
- Init action hook running late after PayPal’s return url?
- How Do I Load My Action Earlier Enough?
- Does WP fire delete_post when trashed posts are automatically deleted?
- How to catch images with blank dimensions?
- How to add a link to WordPress Plugin install Listing
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- Why are two functions over-riding each other?
- Set first image (external) as featured image / thumbnail
- Hook for post permalink update
- Get returned variable from a function to add_shortcode function
- How can I add a custom meta value on file upload?
- How to get an image transferred via FTP or script to appear in Media Manager?
- Create a plugin to change the action to which a function is hooked
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- Using the component outside the editor. select(‘core’) is null
- comment_email hook doesn’t seem to work for comment editor field
- unable to stop loop when using wp_insert_post with publish_post hook
- How to rename image at uploading on specific plugin or post-type in WordPress
- WordPress Ajax callback function from plugin – OOP
- How to show large image in checkout page using WP Ecommerce plugin [closed]
- Adding Attachment Display Settings in custom media frame
- Where and how does WordPress store and use its plugin and hook information?
- edit_{$taxonomy} | Hook
- Using the default wordpress uploader inside plugin
- WordPress after content Hook & external template part
- Changing upload dir in a plugin regardless of post type
- best practice for query string values – get_query_var always empty for my value supplied in query string
- Modifying meta tags after doing ajax call in plugin
- Where to add hooks in a class
- How to use output buffering in WordPress hooked functions?
- Adding option to Gallery shortcode
- Can’t upload image using media_sideload_image
- Get attachments from a post
- I have 2 plugins using the same wp_login action hook and one is not working
- use of do_action() without any functions attached
- How to get all queries’s results after they have executed?
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- How can I create a custom plugin that allows anonymous users to signup without registering?
- Bind a function with its own argument to show something dynamically after every content
- Uploaded attachment not set as featured image
- What’s the hook for filtering every texts of site?
- Hook add_attachment error
- Associate multiple email addresses with the same user account, so they can log in with either
- Update variable value via add_filter
- Custom filter not working
- hook update_option/updated_option empty $old_value and $value
- Configure WordPress to Generate Scheme-less Relative URLs
- How to find list of all functions bind to a particular hook from my plugin?
- How to list all images used on a specific page?
- Screenshots on plugin page taken old [closed]
- apply_filters() and call_user_func() to define and call a function outside a class
- Insert and read media from the WordPress library and call in the plugin
- WordPress5.2.3: Better File Download Plugin validation issue
- Problem in plugin debuging in wordpress
- Uploading images to custom table
- OOP development and hooks
- Plugin Development – Call to undefined function comment_exists()
- Add_action not calling callback function
- How to destroy or dispose wordpress uploder/manager?
- Function not working on any file other than the main plugin file
- Caption Shortcode: what filter to change the image size?
- Does WordPress have something like timer hook?
- Multi hook deploiement
- Can I use a hook other than ‘init’ to handle form submissions?
- Template file structure , wordpress hook for altering the template
- woocommerce single product page hook not working
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- Issue on Getting WP Gallery Items In cpt-single.php As Attachments
- What is the use of wp_schedule_event hook?
- Displaying $_FILES data (simlar to $_POST)
- How do I replace title with my plugin?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Woocommerce: block user removing cart item
- How to automatically convert images to WebP on WordPress?
- Load images from CDN and custom features to “Add Media” dialogue
- Execute callback after REST API request completes + Response is sent
- Set srcset on a block image
- How to customize password reset message page on success if no error in password reset
- Do uploaded files to /tmp/ get deleted in WordPress automatically?
- How to modify the uploads directory for wp.media.frame assigning an subfolder name
- how to execute a function only when i send an order to trash [closed]