Basically, neither fingers nor your wrist should hurt.
Tension is your enemy, you have to become aware of tension before it becomes pain.
In the words of Joe Satriani : No pain, no pain.
If it's the thumb, chances are you're grabbing the neck as if you were falling and needed to hold onto it, that's not the way it should be : the thumb is an anchor for the rest of the hand.
When you feel tension, stop, relax your fingers, neck and shoulders.
Then get back in playing position but do not hold the strings down, use your fretting hand as if it was caressing the strings.
Hold onto that feeling, and carry on practicing.
You can also try practicing slower, which anyway always helps focusing on different aspects of your playing.
music.stackexchange.com/users/29/Pif
Your thumb hurts because you are pushing your thumb backwards on itself in order to support your hand position on the neck.
The only way forward is to practice bar chords as much as you can, and your thumb and hand will eventually become stronger.
Hope this helps.
music.stackexchange.com/users/8/Ali
Here's just some additional thoughts:
My hand usually hurts the most when gripping the neck like this:
This is a grip used by classical guitarists, as they rarely do full-on barre chords.
Note the thumb resting on the back of the neck: when you grip the neck firmly, as you do for barre chords, you put a lot of pressure on your thumb.
It's easy to accidentally choose this grip for barre chords because it initially makes chording faster ; however, stay away from this grip for barre chords!
I prefer to grip the neck like this:
Note how the thumb isn't "pressing" on the back of the neck anymore; it's "pinching" or "hugging" it.
The force from pressing on the strings affects your thumb-hand joint less.
This grip isn't initially as ergonomic as the above grip, but it will help prevent pain, which has been said above is very bad!
music.stackexchange.com/users/None/
I experience this when I haven't played for a while, almost like I strain my thumb.
I haven't found another way to circumvent this but to keep playing (after you've rested your thumb of course
;).
It's like any physical exercise.
But then I might be wrong, which would be great :)
music.stackexchange.com/users/None/
I've answered a similar question before, so same answer.
With barre chords there is a misconception that you need to squeeze hard with your thumb.
It is easily possible to play barre chords without the thumb even on the neck.
If you pull the guitar body onto your own body, then use the fretting arm to pull the barring finger (usually index) onto the fretboard.
I'm not advocating not using your thumb to tension barre chords, but you never need to squeeze as hard as you think.
It's a sort of extension to B.B.King's butterfly vibrato - yes, only fretting one string, but pulling that finger onto it with arm, not thumb.
music.stackexchange.com/users/2808/Tim
Please see my answer to an earlier question here: https://music.stackexchange.com/a/3694/1044
You may be using much more tension and pressure than is necessary to fret the barre chord in the first place, and this may be what is causing the pain.
You can train yourself not to squeeze your hand and fingers too hard.
music.stackexchange.com/users/None/
Certain chords cause my thumb to be sore. How can I play in a way to prevent this?
Why does my thumb hurt when I play bar chords?
music.stackexchange.com
<guitar><technique><chords><health>
music.stackexchange.com/questions/1533
music.stackexchange.com/users/363/gak
Tension is your enemy, you have to become aware of tension before it becomes pain. When you feel tension, stop, relax your fingers, neck and shoulders.  If it's the thumb, chances are you're grabbing the neck as if you were falling and needed to hold onto it, that's not the way it should be : the thumb is an anchor for the rest of the hand.  The only way forward is to practice bar chords as much as you can, and your thumb and hand will eventually become stronger. Be aware of tension and relax. You may not need to squeeze as hard with your thumb as you think. You will become stronger with practice.
Be aware of tension and relax. You may not need to squeeze as hard with your thumb as you think. You will become stronger with practice.