Many have a custom not to eat nuts during elul, because אגוז is gematria חטא (sin). So what exactly is considered nuts? Almonds, Cashews, Pistachios, Macadamian, Hazelnuts, Pecans? How about Peanuts (or doughnuts)? How to classify?
Even though the famous reason for not eating nuts is because of the gematria, there is another reason not to eat nuts from Elul through Hoshanah Rabbah (and this would apply to all tree-nuts and maybe even peanuts) is since they increase phlegm they will hinder one's own ability to pray and disturb others (by clearing the throat) as well. And since we spend so much time praying at this time of year better to not eat anything that may hinder one's ability to do so. It seems that walnuts and hazelnuts are the only one's mentioned by Mateh Efraim and this is probably because those were prevalent in his area. In addition the word "egoz" is also used as a general term for tree-nuts.
Dose of Halacha points out that the custom is only to avoid them on Rosh Hashana itself.
The Rema (OC 583:2) writes that many have the custom to avoid eating nuts on Rosh Hashana. One reason for this is because אגוז is the same gematria as חט, sin (minus the א – the way it is spelled in Talmud Yerushalmi). Similar to the various simanim we eat on Rosh Hashana, we want to remind – and inspire - ourselves to do teshuva as one eats – or avoids - these special foods (Matei Ephraim 583:2). Thus, many avoid bitter foods.
While many avoid nuts throughout the aseres yemei teshuva, there doesn’t seem to be any source for this.
R’ Shmuel Kamenetsky (quoted in Kovetz Halachos: Yomim Noraim) holds that while one may eat food with nuts mixed or baked in, they should not be recognizable. (Thus, smooth peanut butter may be consumed, though chunky peanut butter should be avoided.)
While this is an ashkenazic minhag, some Poskim point out that the Maharam Mi’Rottenburg used to eat nuts on Rosh Hashana.
Halachically Speaking (page 3) writes that almonds are included but one can have peanuts.