Answer: killing him off in a play performed before the kingdom
It seems that Charming has taken a real liking to performing, even though his work is not widely appreciated. He plans an elaborate production, where he stages the rescue of a princess from the tower (possibly the rescue of Fiona from the first "Shrek" movie), only this time his new love, Rapunzel, plays the princess in the tower. Charming plans on having Shrek play the ogre and killing him during the play. While rehearsing for the show, before Shrek is captured, he accidentally kills two of the actors pretending to be Shrek, while searching for the most dramatic way to deliver the killing blow.