Ds1 was like this. He used to wait till he had a nappy on at night till he did a poo. For him it seemed to be a fear thing so we compromised and said he could have a nappy but he had to sit on the toilet to do it (with nappy on) We then cut a little hole in the nappy that got progressively bigger. He learnt that it wasn't so scary to do a poo after a couple of goes with the nappy on and the poo dropping in the toilet. We made a huge deal of the poo in the toilet and he was really proud so started doing poo's in the toilet of his own accord. Only took a few days in the end. Good luck!
Bookmarks