"Wearing a green hat" (戴绿帽) meaning being cheated on dates to the Yuan and Ming dynasties, when male relatives of prostitutes were legally required to wear green headwear. The association stuck.
register
Colloquial and mildly vulgar — fine in casual speech and online, avoid in formal contexts. The fuller form 绿帽子 is equally common.