Ayesha reported,

The Messenger of Allah ﷺ permitted visiting graves.In another narration, Abdullah bin Abu Mulayka reported that Ayesha came back one day from the cemetery. He said, "I asked her, 'Umm Muiminin, where have you come from?'She replied, 'From the grave of my brother Abd al-Rahman bin Abu Bakr.'I asked her, 'Did the Messenger of Allah ﷺ not forbid visiting graves?'She answered, 'Yes, he had forbidden it, then later he commanded that they be visited.'"

Azami 3896

Sahih

عن عائشة

أن رسول الله ﷺ رخص في زيارة القبور. وفي رواية: عن عبد الله بن أبي مليكة، أن عائشة أقبلت ذات يوم من المقابر، فقلت لها يا أم المؤمنين من أين أقبلت؟ قالت: من قبر أخي عبد الرحمن بن أبي بكر، فقلت لها: أليس كان رسول الله ﷺ نهى عن زيارة القبور؟ قالت: نعم كان نهى، ثم أمر بزيارتها.

الأعظمي 3896صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Visiting graves
Section
Recommendation to visit graves
Numbering
Jami al-Kamil 3896 (2nd edition)
Azami 3896