If your friend is out about something to one group (say, their friends) and closeted to another group (e.g. their family or workplace) it's generally wrong to out them without their consent. If you want to avoid doing this, you should not tag or full-name them in public posts that refer to the thing they're closeted about, even on social media with privacy settings such as Facebook. If you do this, anyone who searches for them will be able to find your post. There is no privacy setting that can prevent this from being searchable, at least on Facebook. Nor does blocking such posts from their wall prevent them from being searchable on yours.
Examples of things people may be closeted about in some contexts include but are not limited to sexual orientation (e.g. homosexuality or bisexuality), gender identity (e.g. being transgender), atheism, polyamory, mental illness or disability (e.g. having bipolar or depression), or physical illness or disability.
They can't say this in public posts, because the fact that there is a secret is already more info than they want to disclose. But I don't have that kind of problem - so it falls on me to post this sort of PSA.