He was granted a three-year criminal behaviour order at Wakefield Magistrates’ Court on Tuesday, August 4.
It also bans him from entering Pontefract Castle and Valley Gardens, causing harassment to anyone and using threatening or abusive language.
The order was imposed by magistrates after work by Wakefield Council’s anti-social behaviour unit and West Yorkshire Police.
Coun Maureen Cummings, Wakefield Council’s cabinet member for environment and communities, said: “I welcome the decision of the court to make this banning order.
“It sends out a clear message that we will not tolerate this kind of behaviour which can cause a lot of upset and distress to the victims.
“It is very important that all residents are able to go out and enjoy our wonderful public spaces, including Pontefract Park and Pontefract Castle without fear of harassment.”