Expurgate means removing matter thought to be objectionable or unsuitable from (a text or account). Hence, it is a form of censorship which involves purging anything deemed noxious or offensive from an artistic work, or other type of writing of media.
Bowdlerize is a synonym which also means the same. English editor Thomas Bowdler, who in 1818 published the Family Shakespeare, an expurgated edition of Shakespeare’s plays that omitted or changed any passages that, in Bowdler’s opinion, couldn’t decently be read aloud in a family. As a result, the term bowdlerize is now a synonym of expurgate.
They felt it was necessary to expurgate his letters before publishing them.
The newspaper had to expurgate the expletive-laden speech that the criminal made upon being sentenced to life imprisonment