I am very new in wordpress and I am currently developing a wordpress plugin, I just want to know if there is a wordpress plugin hook that will run when one or more file of wordpress media is deleted.
Thanks,
Dan
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityThe delete_attachment
action is fired when wp_delete_attachment()
function is called to delete an item in the media library.
https://developer.wordpress.org/reference/hooks/delete_attachment/
, it fires before an attachment is deleted, at the start of wp_delete_attachment(). So it is risky if you delete the file but WordPress doesn't due to an error or something.