This is extremely important. The child should sit on the toilet on a daily basis, preferably after a meal, and at same time each day, for at least 15 minutes. During this time the child can read a book or play a game. Doing this repeatedly will create a routine and will re-train the intestine to empty itself daily. In this way the problem of fecal retention will not recur.
Consistency is the key to success.
Finally, a high fiber diet is always important. Drinking plenty of water is also very important. Avoiding junk food, like chips and chocolates, also helps. Additionally, make things fun. Have your child help in preparing these high fiber meals.