Abdullah bin Umar reported,

The Messenger of Allah ﷺ said, "Whoever eats from this plant should not come near our mosques until its smell is gone," meaning garlic.

Muslim 1249

Sahih

حدثنا أبو بكر بن أبي شيبة حدثنا ابن نمير قال ح و حدثنا محمد بن عبد الله بن نمير واللفظ له حدثنا أبي قال حدثنا عبيد الله عن نافع

عن ابن عمر

أن رسول الله ﷺ قال من أكل من هذه البقلة فلا يقربن مساجدنا حتى يذهب ريحها يعني الثوم

مسلم 1249صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Prohibition on those who have eaten garlic, onions, leeks, or similar from attending the masjid
Numbering
Darussalam 1249
Muslim 1249