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.
bayhaqi:7057Abū Muḥammad ʿAbdullāh b. Yūsuf al-Aṣbahānī > Abū Saʿīd b. al-Aʿrābī > al-Haytham b. Sahl al-Tustarī > Yaḥyá b. al-Yamān > al-Minhāl b. Khalīfah > Ḥajjāj b. Arṭāh > ʿAṭāʾ > Ibn ʿAbbās

[Machine] The Messenger of Allah ﷺ entered a grave at night and a lantern was brought to him. He took it from the direction of the Qibla and made four takbirs (saying Allahu Akbar) over it. He then said, "May Allah have mercy on you, if you are indeed a follower of the Quran." This narration is weak in its chain of narrators and it has also been narrated from another weak chain of narrators from Ibn Mas'ud. As mentioned by Imam Shafi'i, who is most famous in the land of Hijaz, he takes it from the later generations and this makes it more likely to be followed. And Allah knows best.  

البيهقي:٧٠٥٧وَأَخْبَرَنَا أَبُو مُحَمَّدٍ عَبْدُ اللهِ بْنُ يُوسُفَ الْأَصْبَهَانِيُّ ثنا أَبُو سَعِيدِ بْنُ الْأَعْرَابِيِّ ثنا الْهَيْثَمُ بْنُ سَهْلٍ التُّسْتَرِيُّ ثنا يَحْيَى بْنُ الْيَمَانِ ثنا الْمِنْهَالُ بْنُ خَلِيفَةَ عَنْ حَجَّاجِ بْنِ أَرْطَاةَ عَنْ عَطَاءٍ عَنِ ابْنِ عَبَّاسٍ قَالَ

دَخَلَ رَسُولُ اللهِ ﷺ قَبْرًا لَيْلًا وَأُسْرِجَ لَهُ سِرَاجٌ وَأَخَذَهُ مِنْ قِبَلِ الْقِبْلَةِ وَكَبَّرَ عَلَيْهِ أَرْبَعًا ثُمَّ قَالَ رَحِمَكَ اللهُ إِنْ كُنْتَ لَأَوَّاهًا تَالِيًا لِلْقُرْآنِ هَذَا إِسْنَادٌ ضَعِيفٌ وَرُوِيَ مِنْ وَجْهٍ آخَرَ ضَعِيفٍ عَنِ ابْنِ مَسْعُودٍ وَالَّذِي ذَكَرَهُ الشَّافِعِيُّ أَشْهَرُ فِي أَرْضِ الْحِجَازِ يَأْخُذُهُ الْخَلَفُ عَنِ السَّلَفِ فَهُوَ أَوْلَى بِالِاتِّبَاعِ وَاللهُ أَعْلَمُ  


See similar narrations below:

Collected by Tirmidhī
tirmidhi:1057Abū Kurayb And Muḥammad b. ʿAmr al-Sawwāq > Yaḥyá b. al-Yamān > al-Minhāl b. Khalīfah > al-Ḥajjāj b. Arṭāh > ʿAṭāʾ > Ibn ʿAbbās

"The Prophet entered a grave during the night, so a torch was lit for him. He took it (the deceased) in from the direction of the Qiblah, and he said: 'May Allah have mercy upon you, you were often invoking (Allah) by reciting the Qur'an.' And he said: 'Allahu Akbar four times."  

الترمذي:١٠٥٧حَدَّثَنَا أَبُو كُرَيْبٍ وَمُحَمَّدُ بْنُ عَمْرٍو السَّوَّاقُ قَالاَ حَدَّثَنَا يَحْيَى بْنُ الْيَمَانِ عَنِ الْمِنْهَالِ بْنِ خَلِيفَةَ عَنِ الْحَجَّاجِ بْنِ أَرْطَاةَ عَنْ عَطَاءٍ عَنِ ابْنِ عَبَّاسٍ

أَنَّ النَّبِيَّ ﷺ دَخَلَ قَبْرًا لَيْلاً فَأُسْرِجَ لَهُ سِرَاجٌ فَأَخَذَهُ مِنْ قِبَلِ الْقِبْلَةِ وَقَالَ رَحِمَكَ اللَّهُ إِنْ كُنْتَ لأَوَّاهًا تَلاَّءً لِلْقُرْآنِ وَكَبَّرَ عَلَيْهِ أَرْبَعًا قَالَ وَفِي الْبَابِ عَنْ جَابِرٍ وَيَزِيدَ بْنِ ثَابِتٍ وَهُوَ أَخُو زَيْدِ بْنِ ثَابِتٍ أَكْبَرُ مِنْهُ  

قَالَ أَبُو عِيسَى حَدِيثُ ابْنِ عَبَّاسٍ حَدِيثٌ حَسَنٌ وَقَدْ ذَهَبَ بَعْضُ أَهْلِ الْعِلْمِ إِلَى هَذَا وَقَالُوا يُدْخَلُ الْمَيِّتُ الْقَبْرَ مِنْ قِبَلِ الْقِبْلَةِ وَقَالَ بَعْضُهُمْ يُسَلُّ سَلاًّ وَرَخَّصَ أَكْثَرُ أَهْلِ الْعِلْمِ فِي الدَّفْنِ بِاللَّيْلِ