Maggots are fly larvae that generally attack roots or plant parts below the ground. These pests include seed-corn, cabbage-root, and onion maggots, as well as leaf miners, which tunnel through leaves rather than roots. Prevent maggots by placing root maggot mats around the bases of plants, or treat the soil with chemicals before planting.