WP Smush Backup Files Are Not Deleted By wp_delete_attachment


Just some plugin feedback...

I've just been working on a plugin and trying to understand why wp_delete_attachment was not deleting media files from the wp-content/uploads directory despite them being removed everywhere else.

Finally clocked that all the remaining files had the ".bak" suffix just before the file extension which were being created due to me clicking the "Backup Original Images (Will nearly double the size of your Uploads Directory)" option in WP Smush.

I think these should either be deleted along with the smushed files ( there are a number of available hooks and filters in wp_delete_attachment and wp_delete ), or at least an option added to WP Smush to choose if you want this to happen ( not sure why you wouldn't! )