This advice originally came from Buddha, and even now, 2600 years later, is very wise I think.
It’s actually more difficult than you might think, to ensure you pause before saying something and work out whether it’s kind, helpful or true. If the answer to any of those is “no”, then you shouldn’t say it.
Another way of looking at things before you speak is to think “who will benefit from what I’m about to say?”. If the answer is you, then do you really need to say it? If it’s someone else, then that’s probably a good thing – but only if it’s kind, helpful and true.
But what’s the alternative, I hear you ask? Silence is the answer. There’s a lot of noise in the world, so why add to it if you’re not being helpful?