It is not prescribed to put palm-leaf stalks or flowers on graves
The hadeeth referred to by the questioner was narrated by al-Bukhaari (218) and Muslim (292) from Ibn ‘Abbaas (may Allaah be pleased with him), who said: The Prophet (peace and blessings of Allaah be upon him) passed by two graves and said: “They are being punished, but they are not being punished for something that was difficult to avoid. One of them used not to take precautions to avoid (his body or clothes being soiled by) urine, and the other used to walk around spreading malicious gossip.” Then he took a fresh palm-leaf stalk and split it in two, and placed one piece on each of the two graves. They said: O Messenger of Allaah, why did you do that?” He said: “Perhaps the torment will be reduced for them so long as this does not dry out.”
Some of the scholars said that the reason why the torment would be reduced for them was that the fresh palm-leaf stalk glorifies Allaah, so that would be the reason why the torment would be reduced. This is subject to further discussion.
Al-Nawawi (may Allaah have mercy on him) said:
This is the view of many or most of the mufassireen concerning the verse (interpretation of the meaning):
“and there is not a thing but glorifies His Praise”
They said: What this means is everything that has life in it. Then they said: The life of everything is in accordance with its nature, and wood is alive so long as it has not dried out and a rock is alive so long as it has not been cut. Some mufassireen and others were of the view that this is to be understood in general terms.
i.e., that the tasbeeh (glorification of Allaah) does not apply only to the fresh leaf in exclusion of the dry; rather everything, fresh or dry, glorifies and praises Allaah.
Al-Khattaabi and those who followed him criticized the action of placing palm-leaf stalks and the like on graves, following this hadeeth. He said concerning this hadeeth: it is to be understood as meaning that he prayed that their torment might be reduced so long as these stalks remained fresh, not that the stalk had any significance in and of itself, nor that there is any significance in the fresh stalk that is not in the dry.
Based on this, this action was something that was only for the Messenger (peace and blessings of Allaah be upon him), and it is not recommended for anyone to place palm-leaf stalks or anything else on graves.
It says in Fataawa al-Lajnah al-Daa’imah:
When the Prophet (peace and blessings of Allaah be upon him) put the palm-leaf stalk on the two graves and hoped that the torment of the two people on whose graves he placed it would be reduced, that was a specific incident related to those two people only, is not to be taken as generally applicable; it applies only to the two whose torment Allaah caused him to know of. That is something that was only for the Messenger of Allaah (peace and blessings of Allaah be upon him), and it is not a universal Sunnah to be done to the graves of the Muslims. Rather it only occurred two or three times, if we count the number of times that the Prophet (peace and blessings of Allaah be upon him) did it. It is not known that any of the Sahaabah did that, and they were the keenest of all Muslims to follow the example of the Prophet (peace and blessings of Allaah be upon him) and to benefit the Muslims. There is only one report from Buraydah al-Sulami, who left instructions that two palm-leaf stalks should be placed on his grave. But we do not know of any of the Sahaabah (may Allaah be pleased with them) who agreed with Buraydah in that.
Shaykh Ibn Baaz said:
That is not prescribed in Islam, rather it is bid’ah (an innovation), because the Messenger (peace and blessings of Allaah be upon him) only placed the palm-leaf stalk on the two graves of the people whose torment he was made aware of; he did not place them on any other graves. From that we know that it is not permissible to put them on graves, because the Prophet (peace and blessings of Allaah be upon him) said: “Whoever introduces anything into this matter of ours (Islam) that is not part of it, will have it rejected.” According to a version narrated by Muslim: “Whoever does anything that is not part of this matter of ours (Islam), will have it rejected.”
Similarly, it is not permissible to write on graves or to place flowers on them, because of the two hadeeth quoted above, and because the Prophet (peace and blessings of Allaah be upon him) forbade plastering over graves, erecting structures over them, sitting on them and writing on them.
Majallat al-Buhooth al-Islamiyyah, 68/50.