A woman said she was frightened of her ex after he bombarded her with phone calls and Facebook messages.
Craig Eyles, of Heath Road in Dewsbury, pleaded guilty to a charge of harassment.
Kirklees magistrates heard that the 26-year-old and Katie White’s relationship ended in November.
But between January 5 and 28 he made an excessive number of phone calls to her.
This forced Miss White to change her phone number but he then contacted other members of her family.
Alex Bozman, prosecuting, said: “He then contacted her via Facebook, she blocked him but he kept opening different accounts.
“He sent her various messages, using language such as: ‘You fat s**g’.”
Miss White kept changing her mobile number but on January 20 received a number of missed called from a withheld number.
She urged Eyles to stop but he told her that he would carry on ringing her and made remarks about taking her child away.
Mr Bozman added: “Miss White said she’s frightened of Mr Eyles’ behaviour.
“She believes that he is capable of violence and will try and take her daughter.”
Magistrates made an indefinite restraining order, banning Eyles from contacting Miss White.
He also has to complete 120 hours of unpaid work and pay £200 costs and £60 victim surcharge.