Why are wigs worn in English court rooms?

Wigs are traditionally worn in courtrooms in the British Isles because it was to conceal the identity of judges and barristers, thus protecting them from attack outside the courts.