Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:21111Abū ʿAlī al-Rūdhbārī > Abū Bakr b. Dāsah > Abū Dāwud > Aḥmad b. Muḥammad al-Marwazī > ʿAlī b. Ḥusayn from his father > Yazīd al-Naḥwī > ʿIkrimah > Ibn ʿAbbās

The verse “And the poets it is those straying in evil who follow them. He (Allah) then abrogated it and made an exception saying: Except those who believe and work righteousness, engage much in the remembrance of Allah." (Using translation from Abū Dāʾūd 5016)   

البيهقي:٢١١١١أَخْبَرَنَا أَبُو عَلِيٍّ الرُّوذْبَارِيُّ أنبأ أَبُو بَكْرِ بْنُ دَاسَهْ ثنا أَبُو دَاوُدَ ثنا أَحْمَدُ بْنُ مُحَمَّدٍ الْمَرْوَزِيُّ حَدَّثَنِي عَلِيُّ بْنُ حُسَيْنٍ عَنْ أَبِيهِ عَنْ يَزِيدَ النَّحْوِيِّ عَنْ عِكْرِمَةَ عَنِ ابْنِ عَبَّاسٍ قَالَ

{وَالشُّعَرَاءُ يَتَّبِعُهُمُ الْغَاوُونَ} [الشعراء 224] فَنَسَخَ مِنْ ذَلِكَ وَاسْتَثْنَى فَقَالَ {إِلَّا الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ وَذَكَرُوا اللهَ كَثِيرًا} [الشعراء 227]  


See similar narrations below:

Collected by Abū Dāwūd
abudawud:5016Aḥmad b. Muḥammad al-Marwazī > ʿAlī b. Ḥusayn from his father > Yazīd al-Naḥwī > ʿIkrimah > Ibn ʿAbbās > And al-Shhuʿarāʾ Yattabiʿuhum al-Ghāwūn Fanasakh from Dhalik Wāstathná

The verse “And the poets it is those straying in evil who follow them. He (Allah) then abrogated it and made an exception saying: Except those who believe and work righteousness, engage much in the remembrance of Allah."  

أبو داود:٥٠١٦حَدَّثَنَا أَحْمَدُ بْنُ مُحَمَّدٍ الْمَرْوَزِيُّ قَالَ حَدَّثَنِي عَلِيُّ بْنُ حُسَيْنٍ عَنْ أَبِيهِ عَنْ يَزِيدَ النَّحْوِيِّ عَنْ عِكْرِمَةَ عَنِ ابْنِ عَبَّاسٍ قَالَ

{ وَالشُّعَرَاءُ يَتَّبِعُهُمُ الْغَاوُونَ } فَنَسَخَ مِنْ ذَلِكَ وَاسْتَثْنَى فَقَالَ { إِلاَّ الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ وَذَكَرُوا اللَّهَ كَثِيرًا }