Offering the funeral prayer over the grave when visiting it
If you already offered the funeral prayer for your father with the people, there is no need to repeat the prayer; rather you should visit his grave and offer supplication for him only; you should go to the graveyard and greet the occupants of the graves with salaam, and offer supplication for them and for your father, as the Prophet (blessings and peace of Allah be upon him) said: “Visit the graves, for they will remind you of the Hereafter.”
The Prophet (blessings and peace of Allah be upon him) used to teach his Companions, when they visited graves, to say: Al-salaamu ‘alaykum ahl il-diyaar min al- Muslimeen wa’l-mu’mineen, wa innaa in sha Allaah bikum laahiqoon, yarham Allaah al-mustaqdimeena minna wa’l-musta’khireen, nas’al Allaah lana wa lakum al-‘aafiyah (Peace be upon you, O occupants of the graves, Muslims and believers. Verily we will, in sha Allaah, join you. May Allaah have mercy upon those who have gone ahead of us and those who will come later on. We ask Allaah for well-being for us and for you).” This is the Sunnah.
So you may greet the occupants of the graves and your father, and pray (du‘aa’) for forgiveness and mercy for him; there is no need to offer the funeral prayer. This applies if you did offer the funeral prayer for him.
But if you did not offer the funeral prayer for him with the people, you may go to his grave and offer the funeral prayer for him within one month or less, if it is one month or less since he died. But if a long time has passed, one should not offer the funeral prayer, according to a number of scholars. Supplication (du‘aa’), praying for forgiveness for your father, asking for mercy for him and giving charity on his behalf are all acts that will benefit the deceased, whether he is a father or anyone else.
With regard to the Mushaf that the deceased left behind, it will benefit him if he left it as a waqf (endowment), as the reward for it will benefit him. Similarly if he gave as a waqf books of beneficial knowledge, Islamic knowledge or any permissible branch of knowledge or science from which the people can benefit, he would be rewarded for that, because it is helping in something good. Another example is if he left some land or a house or a shop as a waqf, for charity to be given to the poor or donated to the mosque by its income. For all of these things he would be rewarded. The Prophet (blessings and peace of Allah be upon him) said according to the saheeh hadeeth: “When a man dies, all his good deeds come to an end except three: ongoing charity, beneficial knowledge, and a righteous son who will pray for him.”
Ongoing charity will benefit the deceased if he was a Muslim, and he will also be benefited by the supplication of his children and others, and by the waqf that he set up for charitable purposes such as a house, land, a shop, date palms and so on. He will benefit from this waqf if people benefit from it, if they eat from its income and benefit from its income, or its income is spent on maintaining and furnishing mosques for the Muslims. End quote.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allah have mercy on him).