Does anyone have a script to clean unused materails from each of selected objects?

that would do it per object with many of them selected , not active only?

Maybe just Outliner → Display Mode → Orphaned Data, select and Right Click, delete?

As far as I understand it the orphaned data include materials not assigned to any object.
I have another issue I have lots of objects having lots of materials in active material index list in matrial properties while only one of them is assigned to object faces.

They unused for a specific object but used somewhere else . So not orphaned .

I see we have “Clean Slots” that removes unused materials from an object list. But it works only for active object.

Oh yes i learnt something :wink: too bad it doesn’t work for all selected…