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.”
Sunan Ibn Majah Book 19, Hadith 20