The Messenger of Allah ﷺ was asked about the child born of fornication, and he said, "A pair of sandals I wear while striving in the path of Allah is better to me than freeing a child born of fornication."
حدثنا أبو بكر بن أبي شيبة حدثنا الفضل بن دكين حدثنا إسرائيل عن زيد بن جبير عن أبي يزيد الضبي
أن رسول الله ﷺ سئل عن ولد الزنا فقال نعلان أجاهد فيهما خير من أن أعتق ولد الزنا
Its chain is daif. Hakim reported it (4/41) from the hadith of Israil with this chain, and Busiri said, "This is a daif chain. Abu Yazid al-Danni is unknown, as stated in Taqrib and other sources." Abdul-Ghani bin Saeed said, "He is munkar al-hadith."