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.
The wording of the story in Tarh at-Tathreeb, reads:
“My father related that he set out to visit the town of Ibraaheem Al-Khaleel at the same time as Shaykh Zayn Ad-deen Abdur-Raheem ibn Rajab Al-Hanbali. When he was close to the town, he said, 'I intend to offer prayer in the mosque of Al-Khaleel,' to avoid the prohibition of undertaking a journey to visit a mosque (other than the three sacred mosques), in accordance with the view of Shaykh Ibn Taymiyyah (from the Hanbali School). My father said, ''I intend to visit the grave of Al-Khaleel ;' then I said to him (Ibn Rajab), 'As for you, you are contradicting the Prophet who said, 'No journey should be undertaken for visiting any mosque (for the purpose of worship) except three mosques…,' while you set out for the purpose of worship to a fourth mosque. As for me, I followed the Prophet because he said, 'Visit the graves;' but did he say '...except the graves of the prophets?'' So he was overwhelmed (by astonishment).'”
This story was mentioned by the son of Al-Iraqi in the context of discussing the permissibility of setting out on a journey just for the sake of visiting the grave of the Prophet and strongly opposing the opinion of Ibn Taymiyyah who forbade this.
The issue is a matter of difference of opinion among the later scholars, but the view that we consider to be the preponderant one is that it is forbidden, in light of the general meaning of the hadeeth that reads, “No journey should be undertaken for visiting any mosque (for the purpose of worship) except three mosques, namely: Al-Masjid Al-Haraam (Makkah), my mosque (i.e. Al-Masjid An-Nabawi in Madeenah), and Al-Masjid Al-Aqsa (in Jerusalem).” [Al-Bukhari and Muslim]
The evidence for this inference (reasoning) is what the authors of As-Sunan reported, that Abu Basrah al-Ghifaari objected to Abu Hurayrah about him going out to the Mount (to pray there) and told him, "Had I reached you before you set out, I would have prevented you from setting out;" and he gave evidence of this hadeeth.
So this is evidence that he is of the view that it is acceptable to interpret the hadeeth in light of its general meaning, and Abu Hurayrah agreed with him.
Also, the Companion Ibn 'Umar provided evidence of this hadeeth, as reported by Ibn Abu Shaybah in his Musannaf, and by Abu Sa'eed Al-Khudri, and by Ibn Shabbah in Taareekh Al-Madeenah.
On the other hand, Ibn Taymiyyah reported that the Companions, the Taabi’is (the generation that followed that of the Companions), and the leading scholars did not differ in opinion on the fact that travelling to the graves and the relics of Prophets is included in the prohibition. However, some latter scholars held that it is permissible, such as Al-Ghazaali, Al-Juwayni, Ibn Qudaamah, and others.
As regards the inference that Al-Iraaqi made in the story using the hadeeth, 'Visit the graves'; then this is not the most preponderant opinion, as the general meaning of this hadeeth is restricted by the hadeeth about the prohibition of undertaking a journey (to a mosque for the purpose of worship); and it is established in the jurisprudence principles that the specific evidence outweighs the general evidence (in the same context). However, Al-Iraaqi was correct in objecting to Ibn Rajab's intention to undertake a journey for visiting the mosque of Al-Khaleel; this is also the opinion of Ibn Taymiyyah .
The issue of undertaking a journey to other than the three mosques; such as traveling to make a lawful visit to the graves in order to supplicate for the dead, to be admonished, and to remember death; in principle, these are among the issues of difference of opinion – as it appears – but what is beyond this, such as undertaking a journey to the graves to call upon the dead, or fulfilling a vow (made to the dead), or dedicating acts of worship to them and so forth, then all this is categorically and absolutely forbidden.
It should be noted that we are not aware with certainty of the location of any graves of Prophets with the exception of the grave of our Prophet Muhammad as stated by Imaam Maalik and others. Tarh at-Tathreeb itself reads, “There are no graves of Prophets of which the location is known for sure, except for the grave of our Prophet Muhammad . As regards the grave of Moosa (Moses) it is only believed to be his grave because of the sign mentioned in the hadeeth; and the graves of Ibraaheem (Abraham) and those with him, may Allaah exalt their mention, are only thought to be their graves because of visions seen in dreams and the like.”
Allaah knows best.