optimize( null, $metadata ); } return $metadata; } /** * Delete the backup file when an attachement is deleted. * * @since 1.0 */ add_action( 'delete_attachment', '_imagify_delete_backup_file' ); function _imagify_delete_backup_file( $post_id ) { $attachment = new Imagify_Attachment( $post_id ); $attachment->delete_backup(); }