It was narrated from Sad bin Abu Waqas that the Prophet(ﷺ) said: If a man were to fill his stomach completely with pus until it destroyed him, that would be better for him than filling (his mind) with poetry.

حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ،‏‏‏‏ حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ،‏‏‏‏ وَمُحَمَّدُ بْنُ جَعْفَرٍ،‏‏‏‏ قَالَا:‏‏‏‏ حَدَّثَنَا شُعْبَةُ،‏‏‏‏ حَدَّثَنِي قَتَادَةُ،‏‏‏‏ عَنْ يُونُسَ بْنِ جُبَيْرٍ،‏‏‏‏ عَنْ مُحَمَّدِ بْنِ سَعْدِ بْنِ أَبِي وَقَّاصٍ،‏‏‏‏ عَنْ سَعْدِ بْنِ أَبِي وَقَّاصٍ،‏‏‏‏ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ،‏‏‏‏ قَالَ:‏‏‏‏ لَأَنْ يَمْتَلِئَ جَوْفُ أَحَدِكُمْ قَيْحًا،‏‏‏‏ حَتَّى يَرِيَهُ خَيْرٌ لَهُ مِنْ أَنْ يَمْتَلِئَ شِعْرًا .

Explanation
تفسير الحديث

This hadith speaks about the value of knowledge and prioritizing the benefits one gains through learning and reflection, rather than getting preoccupied with superficial matters or trivial talk that lacks value. It hints that gaining useful knowledge and understanding is far more beneficial than merely indulging in empty discussions. The Prophet (peace be upon him) compares filling one's belly with pus to filling it with poetry; the implication is that the former is better than the latter, illustrating the priorities in a Muslim's life. Therefore, one should strive towards what benefits them in both their religion and worldly affairs.

هذا الحديث يتحدث عن قيمة العلم وتفضيل الفائدة التي يحصل عليها الإنسان من خلال التعلم والتفكر بدلاً من الانشغال بالأمور السطحية أو الكلام الفارغ الذي لا يحمل قيمة. فيه إشارة إلى أن تعلم الأشياء المفيدة والمعرفة هو ما ينفع الإنسان أكثر من مجرد الاستغراق في الحديث عن الأمور التافهة. النبي صلى الله عليه وسلم يقارن بين ملء الجوف بالقيح وملئه بالشعر؛ فالسمة هنا أن الأول أفضل من الثاني، مما يبين لنا الأولويات في حياة المسلم، حيث يجب عليه أن يسعى نحو ما ينفعه في دينه ودنياه.

Source: Sunan Ibn-e-Majah by Imam Muhammad bin Yazid Ibn Majah al-Qazvini