This article is from the Birds FAQ, by Lanny Chambers with numerous contributions by others.
You will not be able to exclude squirrels entirely, as they are wily
creatures. If you view your interaction with squirrels as a war,
you will lose, and most people find it very demoralizing to be defeated
by an opponent with a brain the size of a ball bearing.
In most cases, you can diminish squirrels' consumption of your bird feed
through three simple tactics:
+ Place your bird feeder on a post at least 10 ft (3 m) away
from any potential jumping-off point.
+ Mount a baffle on the post. A length of stovepipe, closed at the top,
works very well.
+ Ensure that there is some food for squirrels, such as
by tolerating spillage of bird feed.