Squirrels don't like the taste or smell of the spice in cayenne pepper, which will naturally help to deter them from your feeder without any further intervention on your behalf.
To do this, you need to incorporate some cayenne pepper in your bird feeder. A little bit of this spice can go a long way, so start small and slowly add more, if necessary.
Zack DeAngelis, CEO of Pest Pointers, told Homes & Gardens to "make sure that all the birdseed is evenly coated with cayenne pepper" and "to reapply after it rains."
Be cautious when using this hack, as it may be a hazard to local wildlife and stray animals. If you try using a different spice, be sure to check whether it’s safe for birds first.