The Messenger of Allah ﷺ said, "The child belongs to the bed, and the adulterer gets the stone."
حدثنا يحيى بن سعيد عن شعبة وابن جعفر قال حدثنا شعبة عن محمد بن زياد قال سمعت
قال رسول الله ﷺ الولد للفراش وللعاهر الحجر
Its isnad is sahih, it passed previously at 173 and 9273.