"And the poets, the deviators follow them" [Shuara 26:224]. Then this was abrogated and an exception was made, for He said, "Except those who believe, do righteous deeds, and remember Allah much" [Shuara 26:227].
حدثنا أحمد بن محمد المروزي قال حدثني علي بن حسين عن أبيه عن يزيد النحوي عن عكرمة
{والشعراء يتبعهم الغاوون} فنسخ من ذلك واستثنى فقال {إلا الذين آمنوا وعملوا الصالحات وذكروا الله كثيرا}
[Its isnad is hasan] Bayhaqi narrated it: 10/239, from the hadith of Abu Dawud, through his route.