Buraidah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "(In the past) I forbade you from visiting graves, but visit them now."In another narration Messenger of Allah (ﷺ) said, "Whoever wants to visit a graveyard, let him do so, because it reminds us of the Hereafter."[Muslim]. (IT)
App reference (IT): Book 1, Hadith 582 (IT)
Arabic/English book reference (IT): Book 1, Hadith 581 (IT)