While we were traveling with the Messenger of Allah ﷺ at al-Arj, a poet appeared reciting his verses. The Messenger of Allah ﷺ said, "Seize the devil," or "Restrain the devil. For a man's belly to be filled with pus is better for him than to be filled with poetry."
بينا نحن نسير مع رسول الله ﷺ بالعرج، إذ عرض شاعر ينشد فقال رسول الله ﷺ: خذوا الشيطان أو- أمسكوا الشيطان- لأن يمتلئ جوف رجل قيحا خير له من أن يمتلئ شعرا.
Muslim narrated it in the chapter on poetry (2259), from Qutayba bin Saeed Thaqafi, who said, Layth narrated to us, from Ibn Hadi, from Yuhanis, the freed slave of Musab bin Zubayr, from Abu Saeed Khudri, and he related it.This hadith is specific to this man, who perhaps used to recite falsehood and obscenities, and it is applied by extension to everyone who does the same. This is because Allah's statement afterward, "except those who believe and do righteous deeds" [Shuara 26:227], indicates this, for it is an exception from it, and this is supported by the statement of Ibn Abbas that follows.