I was almost to the point of trying Miralax with ds. I didn't because I've heard it can cause cramping. He was potty training. I thought dh and I were very careful not to put any pressure on him, in fact it was ds's idea to start using the toilet. But apparently ds sensed something, he was very stressed about pooping. He was holding it in and was just miserable, and so was I. He had a few painful hard poops and decided he just wouldn't go anymore. I tried all kinds of dietary changes. I hated seeing him so uncomfortable and in pain. I was very stressed and anxious about him being so uncomfortable that I think it just added to it all. I put him back in diapers/pullups. I stopped asking him if he had to poop. Or pee. In fact, I assumed the same attitude i had when he was in diapers, totally unconscious of what was happening in the diaper, just changed it every so often, lol. Within 2 weeks he was pooping freely in the pullup. When he went I was very matter of fact about it, or just a quiet "I bet you feel better now". And he just started going in the toilet the other day, on his own.
Also, ds would willingly sit on the toilet to pee, but hold in his poop while he peed. One day he had diarrhea (or he just couldn't hold it anymore), and the poop just came out with the pee. He was shocked but smiled big and was quite proud of himself. That was a big breakthrough for us.
Another thing I did was take him off all dairy, since his poops were always sort of hard, and started giving him more water and juice (not ideal but I was desperate). That helped soften things up alot. My doctor also recommended apricot or peach nectar (sold in a can in the section with refried beans and tacos) But ds wouldn't drink it.
Your situation may be totally different, but I thought I'd share mine for what it's worth.. You can also get a regular stool softener, like Colace, which just softens the stool, without irritating the colon and causing cramping. Your ped may be able to prescribe one, or direct you to an over the counter source, if you end up needing it. Good luck, it's a tough place to be.