Unfortunately, I would suggest cutting out walnuts as a regular part of your diet. It might be that you're just eating too many of them. Do you prepare them to make them more digestible? Nuts contain enzyme inhibitors that can impair digestion. I have digestive issues with nuts, though they mostly make me feel clogged up and bloated. I don't eat nuts often, and I save them either for treats or for times when I know I'm going to need some portable, non-perishable, quick energy.
That said, if you're eating a really large amount of nuts, like several ounces per day, you might be able to just cut that back to a more reasonable consumption, like an ounce or maybe two, and see if that helps your digestive issues.