This joke uses a double pun. The first one is the title of the play, with 'Earnest' being both an adjective and a traditional male name (spelled E-R-N-E-S-T). The play was written by a man named Oscar Wilde, who had the wild idea to pen it.
The pun in the title of the play ' ' The Importance of Being Earnest ' ' was a Wilde idea .