R.R.
My daughter trained herself at 18 months, peeing and pooping, but when she started preschool at 3 and 3 months she would make a mad dash to the bathroom as soon as we arrived home, running and flying through the door to use it. Our drive home wasn't that long so I suspected she wasn't going at school. I checked with them and sure enough, she would go when they went inside around 9:45, and wouldn't go the rest of the day. She had days we didn't arrive home until 4:15 - 4:30, so she was holding both about 6.5 hours. They started having her "try." per my request, even when she didn't want to, and she would go sometimes. We finally found out she didn't like the small kid-sized toilets, lol! She eventually got over the dislike and used them, but in her case there was a definite reason.
On the other hand, they told me that some children would be fine at school and not at home, and the director always suggested to the parents to have the child use the potty upon arriving at home, and taking them the same intervals they took them at school. If the routine was kept as similar as possible they seemed to stay on track better, the break in routine threw them off.