Put one's foot in it

Put one's foot in it
Meanings
Fig.: to accidentally say or do something offensive or embarrassing for those present
Examples
Last night I really put my foot in it when I told the Lady of the house that her son was a very handsome young man. Too bad he was her fiancé!
Ieri sera ho fatto una gaffe enorme quando ho detto alla padrona di casa
che suo figlio era un bellissimo ragazzo. Peccato fosse il suo
fidanzato!
I thought I was being kind, but I really put my foot in it when I asked him how his young wife was doing. I didn't know she had run away with her aerobic instructor
Pensavo di essere gentile e invece ho fatto una di quelle gaffe quando gli ho
chiesto come stava la sua giovane moglie. Non sapevo che fosse scappata
con l'istruttore di aerobica
Well, I really put my foot in it when I called her Anna. That's the name of her husband's first wife!
Ho fatto veramente una gaffe tremenda quando l'ho chiamata Anna perché Anna è il nome della prima moglie di suo marito!Origin
The “it” in the expression most probably refers to mud or excrement