Sunan Ibn Majah, Book 19, Hadith 2628 (In-Book) ⓘ
It was narrated from Maimunah bint Sa`d, the freed slave woman of the Prophet that : the Messenger of Allah was asked about illegitimate children. He said: “Two sandals in which I wage Jihad are better than freeing an illegitimate child.”
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا الْفَضْلُ بْنُ دُكَيْنٍ، حَدَّثَنَا إِسْرَائِيلُ، عَنْ زَيْدِ بْنِ جُبَيْرٍ، عَنْ أَبِي يَزِيدَ الضِّنِّيِّ، عَنْ مَيْمُونَةَ بِنْتِ سَعْدٍ، - مَوْلاَةِ النَّبِيِّ صلى الله عليه وسلم - أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم سُئِلَ عَنْ وَلَدِ الزِّنَا فَقَالَ " نَعْلاَنِ أُجَاهِدُ فِيهِمَا خَيْرٌ مِنْ أَنْ أُعْتِقَ وَلَدَ الزِّنَا " .
also referenced under: Hadith 2531 (Reference) & Volume 3, Book 19, Hadith 2531 (DarusSalam)