This page contains the following solutions.
My husband made us a moat for our hummingbird feeder to keep ants out of the nectar for just pennies! He cut a water bottle in half, drilled a hole in bottom just big enough to fit the coated wire that holds the feeder on the shepherds hook.
If the bees are chasing your hummingbirds from the feeders, and ants are draining them, as they are mine, you can solve the problem for the most part by making a quick and cheap trap.
I clean and change the sugar water in my hummingbird feeder every other day and was having a big problem with earwigs and ants getting into the container. I think I have solved that problem.
After several years of trying everything possible, I've found that liberally applying vegetable oil all over the shepard's crook and the feeder hanger itself keeps ants away. Nothing toxic, messy, or unsightly, and the ants don't like it!
To prevent ants on hummingbird feeders, use a dryer sheet on the wire supporting the feeder. It works great!