It is so disturbing to me how many doctors put kids on Miralax....and not just for a couple of weeks....for YEARS!! There are so many reasons for constipation, and I highly recommend going the dietary route before reaching for a prescription:
One common reason is not enough fruit/veggies/fiber rich foods.
There could also be a mineral imbalance. Kids who take calcium supplements without magnesium will probably have constipation.
Some kids do not drink enough water.
Kids with constipation could have a food allergy or sensitivity (esp. if it alternates with loose stools)
Taking probiotics is very helpful for all kids - to boost immunity, but it also is very useful in digestive disorders like constipation. Gradually increase water, fiber and fruit & veggie consumption. I really like smoothies - add in 1-2 T of chia seed, some coconut kefir, some spinach, blueberries. Make sure there is a balance of minerals in diet/supplements. Limit sugar, and processed foods.