Mishkat al-Masabih 218
وَعَنْ أَنَسِ بْنِ مَالِكٍ قَالَ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «طَلَبُ الْعِلْمِ فَرِيضَةٌ عَلَى كُلِّ مُسْلِمٍ وَوَاضِعُ الْعِلْمِ عِنْدَ غير أَهله كمقلد الْخَنَازِير الْجَوْهَر واللؤلؤ وَالذَّهَبَ» . رَوَاهُ ابْنُ مَاجَهْ وَرَوَى الْبَيْهَقِيُّ فِي شُعَبِ الْإِيمَانِ إِلَى قَوْلِهِ مُسْلِمٍ. وَقَالَ: هَذَا حَدِيثٌ مَتْنُهُ مَشْهُورٌ وَإِسْنَادُهُ ضَعِيفٌ وَقَدْ رُوِيَ من أوجه كلهَا ضَعِيف
From Anas ibn Malik, who said: The Messenger of Allah ﷺ said: "Seeking knowledge is an obligation upon every Muslim. And one who places knowledge with those unworthy of it is like one who puts a necklace of jewels, pearls and gold on pigs." Reported by Ibn Majah. Al-Bayhaqi reported it in Shuʿab al-Iman up to his saying "Muslim", and said: This is a hadith whose text is well known and whose chain is weak; it has been narrated by several routes, all of them weak.