It’s normally written into your contract that you are not allowed to discuss your wage with others.
This is virtually unenforceable, particularly following the equality act 2010 – if someone is trying to establish if there is a case for an equal pay claim, then they are allowed to ask and people are able to tell them, no matter what the contract says.
I’m on a pay scale, so there is a limited number of amounts I could get paid, and I have a job role within that, so people pretty much know within a range what I’m on, and I have no qualms about telling them what point I’m on.