Ok so, obviously you do not want to be pressing overhead whilst still experiencing pain with overhead movements...that is just common sense! Like with any injury that is non-traumatic, the cause of injury is usually related to faulty biomechanics.
Take a shoulder impingement type injury for example. The reason your rotator cuff muscles or your bicep tendon became irritated is more than likely due to an imbalance somewhere in your shoulder girdle biomechanics or poor core sequencing. This can be due to different sets of muscles affecting others in each individual, it's not a one-size-fits-all kind of problem.
Jumping forward to having corrected the faulty biomechanics and therefore the inflammation settling down to a point where you now have pain free, full overhead range of movement. Yes, you do need to re-learn how to press overhead with good biomechanics. Too many people take the advice of avoiding pressing overhead whilst in pain to mean that they should never press overhead. This is not the case.
Last time I checked we very much need to use overhead movements - do you dress yourself? (putting tops and jumpers on requires your arms overhead); do you enjoy going on holiday? (how would you get your luggage into the overhead locker?); do you have kids who love getting thrown up into the air?; do you have a kitchen with cupboards above head height?; do you play any sport that requires you to move your arms overhead? - the list goes on!
So if you ever have or ever do experience shoulder pain with overhead movements...don't ignore it, get it assessed & corrected and please ensure you get someone to train your brain to move correctly through overhead movements and gradually build up strength so it doesn't happen again.