I had this with two trainees I was supervising on the Future Jobs Fund in a previous workplace.
The place I worked for didn’t have a social media/acceptable use policy. I made sure HR drafted one pretty quick after that – OP, I don’t know if the workplace concerned has a policy to refer to? If they have breached a policy, then the company can decide whether to impose disciplinary action (or at least threaten it if the behaviour continues).
Most workplaces block access to social media on company equipment for this reason, but most people have smartphones now so they can still get on there during work hours.
In my case I had a quiet word with the two concerned – because there were no names mentioned, there was no absolute proof that they were slagging each other off, but it was pretty obvious. I just discussed their ideas of professional behaviour with them and why what you put on social media isn’t always your own private business – the comments they both wrote were making others in the workplace feel uncomfortable, so it became my business as their manager to address it. Worked for 18 year olds in their first job, but not sure if it would for older adults – if they are still doing that sort of thing and they are over 25, they might need to be told to grow up!!!