Gave my kids Magnesium citrate that didn't help - but I think there's another form that works better. Even Senna tea didn't work for them but the Triphala did the job. Plus helped with liver issues one was having.
Magnesium citrate is very good, but magnesium malate is better.
The one form of magnesium that needs to be avoided is magnesium oxide. Magnesium oxide reacts with water to form the caustic magnesium hydroxide that is used as a laxative because it burns the intestinal wall. It can also neutralize stomach acid creating other issues. In addition, magnesium oxide is poorly absorbed. Acidified forms of magnesium, such as malate and citrate are much better absorbed.