
Tainacan does not reliably remove uploaded files from disk when items are permanently deleted. In particular, files of private items — which Tainacan stores in prefixed _x_<item_id> folders — are left orphaned in the uploads directory, slowly bloating disk usage. Tainacan’s own code documents this as an unresolved TODO (Private_Files::rename_item_and_collection_folder_path returns early on permanent deletion).
This add-on fixes that. While it is active, permanently deleting an item always removes its files by default. You can disable this behaviour from Settings Bauhaus File Cleanup for Tainacan if you need to temporarily keep files while the plugin stays active.
This is an independent add-on developed by Bauhaus Tech. It is not affiliated with, endorsed by, or part of the Tainacan project.
It works by hooking WordPress’ before_delete_post, which fires on every permanent deletion regardless of where it was triggered:
wp tainacan ... garbage collector);wp_delete_post( $id, true ) call.For each deleted Tainacan item it:
_x_ folders — by reconstructing the path from the item and collection IDs instead of trusting the (often out-of-sync) attachment metadata.When a whole collection is permanently deleted, its entire tainacan-items/<collection_id> folder is removed too.
wp tainacan garbage-collector --run after deleting a collection to fully clean the database.