Warn (one) off (from someone or something) verb phrase
To tell someone to leave or stay away from a dangerous situation, trouble or thing
The police officer put up signs warning off drivers from this dangerous street.
Professor McGonagall warned Harry Potter off the Chamber of Secrets.
The soldier warned the invader off.
Children are warned off playing near the sockets.
To advise someone not to do something in order to stay safe
Dobby warns Harry off returning to Hogwarts School.
He was warned off driving because he was drunk.
To punish someone or something harshly
Once something has been done, you can do nothing but face the consequences.
White lie
Act in a way that is likely to cause problems for you
The verb "warn" should be conjugated according to its tense. This phrase can be followed by a noun (Intransitive verb) or V-ing, or without a noun (Transitive verb).
It is thought that this phrasal verb originated in horse racing. Before 1969, the British Jockey Club had a rule that allowed it to warn someone off the course, i.e., to prohibit someone who had disobeyed Jockey Club rules from riding or running horses at any of the club's meetings.