When Emma was younger, she faced mild constipation at least once a week. It was bad enough for her as she cried in fear (and pain) and broke into cold sweat while she tried to poo. Sometimes it took 5 mins but for most of the times, it took longer. There would be blood stains once in a while if she exerted too much effort. It was such a pain seeing her struggle.
Fiber, Fluid and Exercise!
Over time, I realised most of the times they happened when she skipped fruits. So, I became more diligent in offering her at least a serving of fruits everyday. Things got so much better now as she has sufficient dose of fiber, fluid and exercise!
According to WebMD, leading health organisations recommend that children ages 1-3 years old should get about 19 grams of fiber per day and children ages 4-8 should eat about 25 grams of fiber daily. It's also important to note that increasing water intake when eating foods high in fiber is crucial. A diet high in fiber without proper water intake can have opposite effect and cause constipation along with other stomach issues.
If your child has a tendency to get constipated, you can try to avoid some foods like refined "white" foods like white rice and white bread, cheese and other dairy productions.