... and why the order was served.
And that would be because....? (you don't have to answer...I know that is private)
I don't know what the laws are in your country, but in mine, a restraining order is not easy to get. The one being served notice of restraint has to have committed an action that is potentially a criminal offense. That is how the orders are enforced - if you break the order, your ass is in jail on the offense that it was originally put in place for.
Custody issues are notoriously volatile and, unfortunately, the child is often put in the middle of a conflict that has nothing to do with them.
I wish you all the best in your efforts to maintain a relationship with your child. What is happening is not the child's fault and it would be a shame if your child suffered from the consequences of the conflict between you and your wife.
Good luck.