1 Answer
1

You need to use before_delete_post action. As its already very late when delete_post action is run. Wordpress un-attach all the attachments before running delete_post action. So when you run get_posts in your delete_attachment function there are no attachments found.