Fencing has to be paramount. I work with pigs that have been trained with electric fences and yet they are not 100% pig proof. The comment regarding barbed wire at the bottom is a good one. As Harmony has stated, ensure the posts are well driven. Pigs will love to root around them which can easily dislodge them if they are not installed correctly.