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]. (JA)
App reference (JA): Book 1, Hadith 582 (JA)
Arabic/English book reference (JA): Book 1, Hadith 581 (JA)