https://sangkrit.net/how-to-auto-delete-attached-media-files-when-wordpress-post-is-deleted/
Automatically Cleanup Attached Media Files When WordPress Post Is Deleted