Once they are constipated, pooping is very painful.
It then becomes not only a biological thing, but an EMOTION based, problem. It is painful. Thus the child 'fears' pooping. Thus, they 'withhold' their poop. Hence, the poop becomes harder and blocked up and impacted... more. Hence it gets more painful internally and when exiting.
Thus a vicious cycle, ensues.
My daughter, at 2 years old, even if we did not force her to poop on a toilet, simply had ANXIETY and stress, about the idea of it.
Hence she got constipated... and all those problems I mentioned above. Hence we saw a Pediatric Gastroenterologist. Hence he said, EVERYDAY he sees children like this. That it is a biological AND emotion based, issue.
Hence it takes, a long time, to overcome.
And to just let... the child poop... for now... even if that is in a diaper.
ONCE the problem is resolved, medically and emotionally and biologically... the child, on their own, will poop, on a potty, when ready.
IF constipation... is worsened by whatever reason... things like "Encopresis" can occur. This is not good. It means, they get an involuntary leaking... of feces which they cannot control, because their innards are all stretched out and blocked up. Internally.
Don't force the issue.
No rewards or punishments... will fix it. For now.