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
- Admin settings update updating every time home page is hit?
- Global Objects and Public Methods
- How do you use the plugin boilerplate loader class to hook actions and filters?
- 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?
- Saving the pre-sanitized filename of an attachment as the Title or Caption
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- 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
- Call activation hook multiple times
- Having Problem On Getting WP Post Gallery Images URL
- Two-step login process – Is it possible?
- Set first image (external) as featured image / thumbnail
- How can I hook into existing WordPress Bulk actions?
- Hook for post permalink update
- Get returned variable from a function to add_shortcode function
- WordPress Media mime type filter problem 4.0
- 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?
- Earliest WP Hook to Safely and Reliably Redirect
- Define a function outside a class and call the function using action or filter hook
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- Synchronize Custom post type tags to WordPress default posts tags
- 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
- Hook into theme-switching later than `setup_theme`
- Save image as featured image
- How to rename image at uploading on specific plugin or post-type in WordPress
- Is it possible to delay execution of shortcode output callback?
- WordPress Ajax callback function from plugin – OOP
- Why my database table not created on activation?
- How to send email in wordpress with more than one attachments
- Act on user meta updated, but only once
- Adding Attachment Display Settings in custom media frame
- Resizing Images for a Gallery-Plugin?
- Is there any way to allow a plugin to write over a previous version?
- Files automatically added
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- How to replicate Media Library “Add New” on Plugin Settings Page
- Plugin writing: access file that was just uploaded
- Modifying meta tags after doing ajax call in plugin
- how to add custom functionality after woocommerce place order button
- Where to add hooks in a class
- How to use output buffering in WordPress hooked functions?
- Conditional hook based on the core function that is calling it
- Adding option to Gallery shortcode
- Get attachments from a post
- I have 2 plugins using the same wp_login action hook and one is not working
- How dynamic action login_form_{action} is working
- How to get all queries’s results after they have executed?
- flush rewrite rules after plugin update?
- 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?
- hook filter after the_content on a specific page
- Associate multiple email addresses with the same user account, so they can log in with either
- Run command “composer install” when activating wordpress plugin
- Custom filter not working
- Configure WordPress to Generate Scheme-less Relative URLs
- How to submit/upload data to database and in specific folder?
- Get audio metadata on file upload
- Ajax +wordpress onClick link redirect to new page and create html content
- How to replace settings in WordPress plugin from a theme
- Creating posts with links from a txt file
- The URL of images on my website changed after being set as featured image
- apply_filters() and call_user_func() to define and call a function outside a class
- WordPress Favicon not Working For Images/Videos/PDFs
- what functions to use to resize images and create DB metadata for them after/during upload?
- Plugin Development – Call to undefined function comment_exists()
- Prevent plugin activation and add admin notice
- How to destroy or dispose wordpress uploder/manager?
- Does WordPress have something like timer hook?
- Can I use a hook other than ‘init’ to handle form submissions?
- Template file structure , wordpress hook for altering the template
- Changing upload directory for plugin uploads only
- 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 can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Send retrieve password notification email with custom HTML email template
- Add a custom image source
- Ninja Forms: Front-End Forms, Post ID?
- upload image to wordpress media library failed for custom post type