I’m developing a plugin that uses an XML file to store some attachments picked up from the media gallery.
I need to synch the media gallery and the XML file when an attachment is deleted from the Media Library, so the “delete_attachment” hook fits good for me.
BUT…it doesn’t fire.
I tried the simpliest function but it doesn’t work:
function onWpDelete( $targetID ){
wp_die('Deleted attachment ' . $targetID);
}//onWpDelete
add_action('delete_attachment', 'onWpDelete');
It’s stored in a functions.php file on the plugin directory that works for sure because there are other functions in there.
Thank you!