Madan bin Abu Talha reported,

Umar bin Khattab stood up to deliver the Friday sermon. He praised Allah and glorified Him, then said, "People, you eat from two plants which I can only regard as foul, this garlic and this onion. In the time of the Messenger of Allah ﷺ, whenever a man was found to have their smell on him, he would be taken by the hand and led out to al-Baqi. So whoever must eat them, let him kill their odor by cooking them thoroughly."

Ibn Majah 3363

Sahih

حدثنا أبو بكر بن أبي شيبة حدثنا إسمعيل ابن علية عن سعيد بن أبي عروبة عن قتادة عن سالم بن أبي الجعد الغطفاني

عن معدان بن أبي طلحة اليعمري

أن عمر بن الخطاب قام يوم الجمعة خطيبا فحمد الله وأثنى عليه ثم قال يا أيها الناس إنكم تأكلون شجرتين لا أراهما إلا خبيثتين هذا الثوم وهذا البصل ولقد كنت أرى الرجل على عهد رسول الله ﷺ يوجد ريحه منه فيؤخذ بيده حتى يخرج به إلى البقيع فمن كان آكلهما لا بد فليمتهما طبخا

ابن ماجه 3363صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Foods
Chapter
Eating garlic, onions, and leeks
Numbering
Darussalam 3363
Ibn Majah 3363