I believe Ziyad's family informed me that he traced this report back to the Prophet ﷺ, who said, "The rider travels behind the funeral procession, while the one on foot may walk behind it, in front of it, to its right, or to its left, staying close to it. The miscarried infant is prayed over, and forgiveness and mercy are invoked for its parents."
حدثنا وهب بن بقية عن خالد عن يونس عن زياد بن جبير عن أبيه
وأحسب أن أهل زياد أخبروني أنه رفعه إلى النبي ﷺ قال الراكب يسير خلف الجنازة والماشي يمشي خلفها وأمامها وعن يمينها وعن يسارها قريبا منها والسقط يصلى عليه ويدعى لوالديه بالمغفرة والرحمة
[Its isnad is sahih]. Tirmidhi transmitted it in the chapter on funerals, in the section on what has been said about the prayer over children, hadith no. 1031, from the hadith of Ziyad bin Jubayr, with this wording, and he said, hasan sahih. Ibn Majah also narrated it, hadith no. 1507, as did Nasai, hadith no. 1950. Ibn Hibban graded it sahih, hadith no. 769, and Hakim graded it sahih according to the standard of Bukhari, 1/363, and Dhahabi agreed with him.