All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
In principle, the acts of worship should be done according to the Sharee’ah and it is not permissible to innovate new acts of worship without religious evidence. ‘Aa’ishah narrated that the Prophet said: "Whoever introduces into this matter of ours (Islam) that which is not part of it, it will be rejected." [Muslim]
The religious texts that are reported about the dead before conducting the funeral prayer on him and burying him are to supplicate for him. The Prophet supplicated for Abu Salamah after his death saying: “O Allaah, forgive Abu Salamah, raise his degree among those who are rightly guided, grant him a successor in his descendants who remain, and forgive us and him, O Lord of the Universe, and make his grave spacious, and grant him light in it.” [Muslim]
As regards reciting a given mention of Allaah, or reciting poetry praising the Prophet at the dead body, then this is not reported from the Prophet it has no authentic source and it is an innovation.
The matter is even worse if this poetry that praises the Prophet extols the Prophet or includes expressions of Shirk [associating partners to Allaah] because this is misguidance without doubt.
Finally, one should advise the people who do these matters that this is not permissible because it is an obligation to abide by the Sharee’ah and not transgress its limits.
Allaah Knows best.