The World Federation One Stop Fiqh

Ruling 596

If a corpse is intentionally, forgetfully, or for some other reason buried without the prayer being performed for it, or if after burying a corpse it becomes known that the prayer performed for it was invalid, it is not permitted to exhume the body to perform the prayer for it. However, there is no problem if, before the body decomposes the prayer is performed at the grave-side with the intention of rajāʾ while observing the conditions mentioned earlier for this prayer.