(5) Establishing the Prayer and the Sunnah Regarding Them
كتاب إقامة الصلاة والسنة فيها
(58) Chapter: “Whoever eats garlic, let him not come near the mosque”
(58) باب مَنْ أَكَلَ الثُّومَ فَلاَ يَقْرَبَنَّ الْمَسْجِدَ
Sunan Ibn Majah 1016 
It was narrated that Ibn ‘Umar said:
“The Messenger of Allah (ﷺ) said: ‘Whoever eats anything from this plant, let him not come to the mosque.’”
حَدَّثَنَا مُحَمَّدُ بْنُ الصَّبَّاحِ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ رَجَاءٍ الْمَكِّيُّ، عَنْ عُبَيْدِ اللَّهِ بْنِ عُمَرَ، عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ ‏ "‏ مَنْ أَكَلَ مِنْ هَذِهِ الشَّجَرَةِ شَيْئًا فَلاَ يَأْتِيَنَّ الْمَسْجِدَ ‏"‏ ‏.‏
Grade :  Sahih (Darussalam)
Reference : Sunan Ibn Majah 1016
In-book reference : Book 5, Hadith 214
English translation : Vol. 1, Book 5, Hadith 1016