We had that problem except our 2 year old guy wouldn't let us put a pull-up back on him once he was in undies and WOULD NOT ever poop in them, so he'd just hold it for 3 days at a time. It was an absolute nightmare, but the pediatrician told us start giving him daily Mirolax and a suppository if it gets to Day 3. He never had "tablet time" so we allowed it if he would at least sit on the potty, which with the help of Mirolax, bought enough time for it to "slip right out". I'd give him 2 M&Ms and a small cookie (child never had a sweet before) if he pooped. Took about 3 weeks, but now we have a consistent pooper who happily goes potty without the help of Mirolax and doesn't even expect a treat. Good luck. I remember losing my mind when we were going through it, but eventually almost every kid figures it out.