When ʿAbdullah bin 'Ubai died, his son ʿAbdullah bin ʿAbdullah came to Messenger of Allah ﷺ and asked him to give him his shirt in order to shroud his father in it. He gave it to him and then ʿAbdullah asked the Prophet ﷺ to offer the funeral prayer for him (his father). Messenger of Allah ﷺ got up to offer the funeral prayer for him, but ʿUmar got up too and got hold of the garment of Messenger of Allah ﷺ and said, "O Messenger of Allah ﷺ Will you offer the funeral prayer for him though your Lord has forbidden you to offer the prayer for him" Messenger of Allah ﷺ said, "But Allah has given me the choice by saying: '(Whether you) ask forgiveness for them, or do not ask forgiveness for them; even if you ask forgiveness for them seventy times..' (9.80) so I will ask more than seventy times." ʿUmar said, "But he (ʿAbdullah bin 'Ubai) is a hypocrite!" However, Messenger of Allah ﷺ did offer the funeral prayer for him whereupon Allah revealed: 'And never (O Muhammad) pray for anyone of them that dies, nor stand at his grave.' (9.84) (Using translation from Bukhārī 4670)
لَمَّا تُوُفِّيَ عَبْدُ اللهِ بْنُ أُبَيِّ بْنِ سَلُولٍ جَاءَ ابْنُهُ عَبْدُ اللهِ بْنُ عَبْدِ اللهِ إِلَى رَسُولِ اللهِ ﷺ فَسَأَلَهُ أَنْ يُعْطِيَهُ قَمِيصَهُ يُكَفِّنُ فِيهِ أَبَاهُ فَأَعْطَاهُ ثُمَّ سَأَلَهُ أَنْ يُصَلِّيَ عَلَيْهِ فَقَامَ رَسُولُ اللهِ ﷺ لِيُصَلِّيَ عَلَيْهِ فَقَامَ عُمَرُ فَأَخَذَ بِثَوْبِ رَسُولِ اللهِ ﷺ وَقَالَ يَا رَسُولَ اللهِ أَتُصَلِّي عَلَيْهِ وَقَدْ نَهَاكَ اللهُ أَنْ تُصَلِّيَ عَلَيْهِ فَقَالَ رَسُولُ اللهِ ﷺ إِنَّمَا خَيَّرَنِي اللهُ فَقَالَ {اسْتَغْفِرْ لَهُمْ أَوْ لَا تَسْتَغْفِرْ لَهُمْ إِنْ تَسْتَغْفِرْ لَهُمْ سَبْعِينَ مَرَّةً فَلَنْ يَغْفِرَ اللهُ لَهُمْ} [التوبة 80] وَسَأَزِيدُ عَلَى سَبْعِينَ قَالَ إِنَّهُ مُنَافِقٌ قَالَ فَصَلَّى عَلَيْهِ رَسُولُ اللهِ ﷺ فَأَنْزَلَ اللهُ ﷻ {وَلَا تُصَلِّ عَلَى أَحَدٍ مِنْهُمْ مَاتَ أَبَدًا وَلَا تَقُمْ عَلَى قَبْرِهِ} [التوبة 84] الْآيَةَ