One way to keep squirrels out of bird feeders is to mount a feeder on a smooth metal pole at least 12 feet from any tree or roof. Another option is putting a wire cage around the feeder with openings only large enough for a small bird to fit through.
Squirrel baffles that stop squirrels from climbing up to or down to bird feeders can be installed. They are usually at least 15 inches wide and designed to slope or tilt if a squirrel tries to climb on them. Bird feeders with doors that close under the weight of squirrels are also available. Because birds cannot taste hot peppers and squirrels can, adding hot cayenne pepper to birdseed can deter squirrels.