Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:17:31

And do not kill your children for fear of poverty. We provide for them and for you. Indeed, their killing is ever a great sin.  

And do not slay your children, by burying them alive, fearing penury, poverty. We shall provide for them and for you. Slaying them is truly a great sin.
القرآن:١٧:٣١

وَلَا تَقْتُلُوا أَوْلَادَكُمْ خَشْيَةَ إِمْلَاقٍ ۖ نَحْنُ نَرْزُقُهُمْ وَإِيَّاكُمْ ۚ إِنَّ قَتْلَهُمْ كَانَ خِطْئًا كَبِيرًا  

{ولا تقتلوا أولادكم} بالوأد {خشية} مخافة {إملاق} فقر {نحن نرزقهم وإياكم إن قتلهم كان خطأ} إثما {كبيرا} عظيما.