How to potty train a boy?

My son is four years old, will be 5 in August. He was slow at catching on to potty training… but once he started, he went all the time. He did this for about eight months. Then the last couple of months, he has started pooping on himself. He wears briefs and boxer shorts. He still goes to the potty to pee just fine. I’m not sure what’s going on… so I took him to his pediatrician, and she thought it was bc he is constipated. I don’t think that… he is pooping normal bowel movements and goes often. He doesn’t complain of any pains in his belly or bottom. I’m just lost on what to do… he will be starting school soon, and I don’t want this to be an issue for him. Open to any advice… FYI: this is my first time having a boy.