Hi A.,
Both my son and my cousin's son had the same issue (as did many kids, both boys and girls, in my son's preschool class, though they were more like 3 yo. We had to deal with the constipation, pain, and everything. Our son was already on Miralax (had several GI issues). My cousin and I used different approaches, but both worked. I used a sticker chart. We took a sheet of construction paper and wrote Monday - Sunday across the top and added pictures our son helped us come up with (he was not exactly reading at that point!). For example, we drew a monkey for Monday, a french fry for Friday, Saturn for Saturday, etc. Then, we added lines to make the sheet look like a calendar. Next, we showed our son the stickers we had purchased (cheap at local craft store) and explained how to earn them. We put a small star sticker in a day's box for peeing in the potty/toilet, a big balloon sticker for pooping in the potty/toilet (bigger=better in his mind and he luuuuuuuvs balloons), and a special glittery star sticker (bigger than star for peeing) for going to the potty, whether pee or poo, without our having to ask. We also bought small gifts (a small coin purse with a monkey on it, for ex) that we gave him for having a certain number of days on each line (week) with balloon stickers. We also talked to him a little about how the doctor explained that pooping would not hurt if he just relaxed and let it happen when he first felt the need but that holding it in and waiting would make it hurt. We also let him know that his bottom needed time to heel so the first couple of times just relaxing might not feel a lot better but that it would get better in a few days. We likened relaxing to a tight fist and holding ones breath and then showed relaxing as taking a big exhale and letting the fist slowly open to a relaxed state. It seemed to work. Also, he was willing to pee on the big toilet before he would poop in it. He insisted on using his potty for that. It seemed like he was afraid that he was losing some important body part (like his arm!) when he pooped. He would go in the potty and then would help us dump the poop into the toilet and flush. After a couple of months he got over this fear. Finally, on our GI's advice, we made a big to do (clapping, high fives, hugs, etc.) for his first potty/toilet poop and then immediately tuned it down to a smile and a calm "Nice job! What color balloon sticker would you like?" for subsequent successes. We wanted him to know that he had done something good and important but that it was also something he was expected to do, not a special event each time he did it. What I liked about the method we used is that we used only positive reinforcement and removed the power struggle issues we were falling into. My cousin's pediatrician suggested she use a children's Fleet suppository, which causes pooping within about 30 seconds, and put her son on the toilet. He inevitably pooped on the toilet. Then she was to give him a special treat (she used chocolate -- yuck on the imagery, plus food as a reward is not what most recommend, however...).
This method worked for her son. In moments of desperation, I considered this approach, but I really wanted to give our son the opportunity to choose to go (with some non-food bribery -- so not above that for potty training). After a month of stickers, he was consistently using the toilet for poops without prompting. He was a bit older than your son and never had poop accidents, even with Miralax. He just got super constipated. It's interesting that you mention that your son used to use the toilet. We went through the same thing with peeing. He was doing fine but had an accident his first day back to preschool (he was a teeny past 3), and the teacher recommended a pull-up. HUUUUUUUUGE mistake! I'm not sure if he got confused or felt deflated/punished, but suddenly he went from two weeks of accident-free peeing to refusing to use the potty. We ended up in a power struggle -- we could not understand why he had been potty trained but was no longer. We had to take about a three month break from potty training (no discussing it unless he brought it up, which he didn't), and then go to the sticker chart and undies. For some reason (calling Dr. Freud?), potty training can turn into a major show of power and control for some kids. Perhaps they can smell our desperation? Anyway, I know that this process is no fun. Maybe you can stick to diapers for now (he can undo them to pee? maybe not -- depends, I guess, on how much trouble the poop accidents are causing), go onto a laxative of some sort such as prune juice or Miralax, help him understand that he needs to let himself relax and poop to stop the pain, get so that he has no pain with pooping, lay off the potty training, and then, when he is feeling better and everyone is ready (no power struggle/control issues around potty training), you can try some sort of low-key reward system. A key for us, I think, was that our son had control over whether and when he got stickers. Depending on the stickers, he got larger (under $10 for sure) rewards based on our rules. We bought about five rewards but only needed to use two or three. Sorry I've rambled on so much; I hope some of this is helpful!
K.