Below, we spoke to a gardening expert about their best tips for deterring pests in compost.

This includes meat and dairy products, including bones.

Flies, bees, and other insects are attracted to protein foods like these.

compost in backyard

Catherine McQueen / Getty Images

Additionally, avoid adding animal feces or cat litter to your compost as these can attract potentially harmful parasites.

Want more gardening tips?

Maintain Healthy Moisture Levels

Ideally, you want your compost to be moist but not soggy.

Adding water every few days helps the decomposition process along.

Sprinkle it over the top layer of compost every few inches to help deter maggots forming from fly larvae.

This will help prevent wildlife from entering from the lower part of the bin or enclosure.

Mice and other rodents dislike peppermint, so this is one to use to try and keep them away.

Place food scraps in the center of the bin, then layer plant material on top.

Rats and mice dislike the smell of peppermint.

Placing containers with mint plants near the compost may deter them.

Keeping your compost properly aerated and at a consistent moisture level helps deter pests.

You should also avoid throwing meat or dairy items into your compost.

Some gardeners have no problem with eggshells in compost, while others find they attract rodents.

Rinsing the eggshells in water before placing them in compost may deter rodents somewhat if you notice a problem.

Tips for composting in the summertime.

(n.d.).Cornell Waste Management Institute.

Retrieved from https://stlawrence.cce.cornell.edu/resources/composting-preventing-animal-nuisances