I have to really limit garlic. Otherwise he gets an upset tummy.
I can't eat onions, except in very very small bits, otherwise he doesn't like the taste of my milk.
Sun, as for figuring it out... start with the usual suspects. Many LOs have trouble with chocolate, garlic, onions, brocolli, and other strong flavors or spices. Eliminate one of those that you eat most of... wait a couple of days and see if it gets better. If you really want to test it, if you think it got better, eat it again and see if it gets worse again. That is what I ended up doing with garlic.
As for onions, there seemed some days that LO just didn't like to stay on the boob well (unusual for him). He would try to eat but keep coming off and going on and coming off and going on.
He was REALLY bad one day and it dawned on me I had dinner with a LOAD of onions the night before. I cut out onions and haven't had much of a problem with that since. When I get a sneaky onion, he usually comes off like that again for at least one feed shortly after.