Will your presence tempt you from the Faith? You cannot go.
Is the wedding a celebration of direct sin? Ie. a ss couple? You cannot go.
Will your presence give others the wrong idea? (Oh, well, a Catholic getting a divorce and remarrying after all these years, even though his ex is still around, can’t be so bad because you went to it.). You cannot go.
Is the wedding that of those not Catholic, and not involved in overt sin or scandal?
Are these close friends or family who will be driven away from truth by your non attendance?
Is attendance a professional expectation? Your law partner's son’s wedding? Attendance expected because of your rank in the military? Marriage of fellow officer?
I believe it’s okay to attend these, but refrain from joining in actual worship if the wedding is in a false, heretical, or schismatic religion. You can sit politely towards the back or side. Maybe pray the Rosary silently. Be discreet. You’re there to support individual persons, not to support a false religion, a lack of religion, or a union forbidden by the Catholic Church.
Consult a priest, because every case is different.