I found it somewhat effective in small raised beds: flaked or powdered hot Thai chili peppers. But one good rain, or a few days of mist & drizzle removed the effect.
I was only keeping cats and squirrels away - lazy cats and not-very-hungry squirrels.
Even so, they ate some of my flower bulbs and I finally bought a roll of chicken wire and weighed it down with bricks. That worked.
it also let me stop thinking about posts I got that wild animals would "scratch their own eyes out" if they got any pepper powder into their eyes.
I have read that in India, Bhut Jolokoi peppers are rubbed on fences to keep wild elephants out of gardens.
I don;t know about either of the above statements myself, but despite the rain, just a few applications of the kind of Thai pepperflakes we put on pizzas have kept ALL wild elephants out of ALL my beds. It is clearly 100% effective at that.