This excerpt is taken from the book of Sheikh al-Islam Imam Ibn Taymiyyah, may Allah have mercy on him, Al-Jawab al-Bahir fi Zuwar al-Maqabir, translated by Sheikh Ataullah Saqib.
Some Authentic Traditions Regarding the Prophetic Visit
The Four Imams and other Imams of Islam did not trust the narrations that some people mention. A few of these are as follows.
The Prophet Muhammad (peace be upon him) said:
من زارنى فى مماتى فكأنما زارنى فى حياتى
"Whoever visits me after my death, it is as if he has visited me during my life."
In another narration, it is said:
من زارنى وزار أبى یعنی ابراہیم خلیل اللہ علیہ السلام فى عام واحد ضمنت له على الله الجنة
"Whoever visits me and my father in the same year, I guarantee him Paradise."
None of the Imams of Islam narrated these and none trusted them, nor did the authors of the Sahih collections include them in their books, nor did the Ahl al-Sunan transmit them. Sahih and Sunan are books whose narrations can be trusted. These narrations are not only weak but fabricated, as the scholars of Rijal have written.
The person who visited the Messenger of Allah (peace be upon him) during his blessed life will be counted among those who migrated towards him. Even if a person spends gold equal to the size of Mount Uhud in comparison to these sacred souls, the reward of such a person cannot equal even one or half a Mudd (measure) of the Companions (may Allah be pleased with them). Even if this person performs obligatory duties, he cannot compete with the Companions (may Allah be pleased with them), let alone voluntary worship! On the contrary, what will be the condition of a person who does an act that is not a means of nearness to Allah, or does something which the Messenger of Allah (peace be upon him) forbade?
Imam Malik (may Allah have mercy on him) even said that it is not permissible for a person to say ”زرت قبر النبى صلى الله عليه وسلم“, saying this and similar words is disliked, because such words are not found in the Sunnah of the best of creation. Many reasons have been cited for this ruling.
In the light of general hadiths about visiting graves, some people have permitted saying this phrase, which is not correct.