Question
My 5yo has learned some bad words from older kids but the other day my husband got frustrated with a project he was doing and he said some bad words and my son and I who were downstairs were able to hear them all.
My son was laughing so I told him that his daddy was frustrated and was using words that are not proper to use because he forgot how to breath and calm himself ( I did not know what else to say).
The problem is that now those bad words are his favorite thing to say when he wants to be funny or when he is upset. Most of the time I ignore his words but sometimes I say, “hey buddy we do not talk like that”. And he says, “yes we do because daddy says it “ and he is right. My husband was very embarrassed that he was caught saying bad words because he is the first one that always gets upset when my son says bad words. What can I tell my son? I told him the other day, ”yes some adults say bad words but while you live with mommy and papi it is not okay to say them, when you are an adult you can speak however you want.”
Another thing .. We had relatives visiting and I prepared him for days telling him to not use any bad words. He promised me he was going to behave but as soon as they entered the house he got super excited and the way to express it was saying all the bad words in the world running around the house.
I was so embarrassed that I gave him the worst look in the world. After all that preparation for him to behave and at the end he just acted like a 5 year old . Any advice ?
Answer
Give yourself some grace. Your boy has shown that his impulse control needs more development and your preparation was up against his brain and in this scenario his brain and the need to be in pleasure won.
That being said when a child says a bad word, it is important to speak to the intention behind using the bad word rather than talking only about the bad word
For example, when he said the bad word when your family was in town, his intention was to be funny and to have everyone immediately look at him and give him attention and connection. 
So all you have to say to him is, “you wanna make us laugh, you want us to see you but bad words are not the right way to do that. How about you tell us a joke?“.
You will do this every time. Keep it short, keep it sweet. If he doesn’t answer, move onto the next thing. What is most important is to talk about the intention behind the bad word rather than the actual bad word.
One final thing that does need to happen is for your son and your husband to talk about when he heard his father say bad words. Tell dad to speak to his son about why dad thinks dad made a mistake when he said those bad words and what he wants your son to do instead of using bad words to be funny or when he is frustrated.