The Messenger of Allah ﷺ said during the battle of Khaybar: He who ate of this plant, i. e. garlic, should not come to the mosques. In the narration of Zubair, there is only a mention of" battle" and not of Khaybar.
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ فِي غَزْوَةِ خَيْبَرَ مَنْ أَكَلَ مِنْ هَذِهِ الشَّجَرَةِ يَعْنِي الثُّومَ فَلاَ يَأْتِيَنَّ الْمَسَاجِدَ قَالَ زُهَيْرٌ فِي غَزْوَةٍ وَلَمْ يَذْكُرْ خَيْبَرَ