Shooting them in a trap in Texas is fowned upon. Some of the old timers say that a hog will never enter a trap in which another hog has been killed. Now I think that is just bs, but they will get right angry with you if you do it.
I have seen numerous hogs that could easily have been taken with a shot to the head from a .22. I don't consider them very dangerous if you pay attention. I jumped over one in the dark one time. He wasn't charging me, I was just in the way. One of my hog dogs was hot on his trail (about 3 feet behind him). It seemed the prudent thing to do. I have also seen a man skewered in the leg with a tusk, but it was his own fault because he was stupid. Those red ones are the meanest, however. A little 40 lb red one is the equal of a 250 lb black hog when it comes to attitude and are the most likely to hurt you.
Most folks that hunt hogs with a dog or dogs don't want you to shoot around their dog(s) anyway. If you want to kill him you need a knife. Otherwise, if you are hunting them from a ground blind, like deer, they are easy to kill with a well placed shot. An accurate load with 10 grs of Unique and a 180 grain cast in your favorite .30/.31 caliber rifle should do the trick.
As for the ones in a trap, those are brought home alive and fed out for butchering later. They are smart and easily tamed. I had some in a pen once that got out. They came back home at dinner time.