Remove all widgets except for one?

I want to remove all widget classes except for one, that needs to be on at all times.

What I would like is “Remove All Widgets” to have an ‘ignore’ array so I can plug in the classes I don’t want to be removed.

All the ideas I have came up with are messy and complicated. The correct solution is often the most simple, but I can’t find an elegant work around.

Any ideas?

You can use the remove from parent node