The roots of French and African marigolds contain a substance that repels nematodes, which are microscopic roundworms that live in the soil, according to Robert Beyfuss, Greene County Cooperative Extension in New York and Marvin Pritts, Associate Professor, Cornell University. Some plants, such as herbs, help mask the smell of the plants they protect, making it difficult for the bugs, who rely on their sense of smell, to find the crops they prefer to eat. Flowers with flat tops, such as carrot, parsnip and dill, attract beneficial insects into the garden that prey on bad bugs.
According to the Maryland Master Gardener Handbook, plant the trap crops first, so the bugs are attracted to them. Once the trap crop has attracted the pests, cover the crop with a black plastic bag, remove the trap crop and destroy it.
Avoid using chemicals, even organic ones, because good bugs are essential to companion planting success.