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.
quran:26:227

Except those ˹poets˺ who believe and do righteous deeds and remember Allah often and defend ˹the Muslims˺ after they were wronged. And those who have wronged are going to know to what ˹kind of˺ return they will be returned.  

Save those, poets, who believe and perform righteous deeds and remember God frequently, in other words, ˹those whom˺ poetry does not distract from the remembrance ˹of God˺, and vindicate themselves, by lampooning the disbelievers, after they have been wronged, by the disbelievers’ reviling of them ˹as belonging˺ together with all believers — such ˹individuals˺ are not reprehensible. God, exalted be He, says: God does not like the utterance of evil words out loud, unless a person has been wronged ˹Q. 4:148˺; He, exalted be He, also says: so whoever commits aggression against you, commit aggression against him in the manner that he committed against you ˹Q. 2:194˺; and those, poets and others, who are wrongdoers will soon know the reversal, the return, with which they will meet, ˹by which˺ they will return, after death. Meccan; it consists of 93, 94, or 95 verses revealed after sūrat al-Shu‘arā’.
القرآن:٢٦:٢٢٧

إِلَّا الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ وَذَكَرُوا اللَّهَ كَثِيرًا وَانْتَصَرُوا مِنْ بَعْدِ مَا ظُلِمُوا ۗ وَسَيَعْلَمُ الَّذِينَ ظَلَمُوا أَيَّ مُنْقَلَبٍ يَنْقَلِبُونَ  

{إلا الذين آمنوا وعملوا الصالحات} من الشعراء. {وذكروا الله كثيرا} لم يشغلهم الشعر عن الذكر {وانتصروا} بهجوهم الكفار {من بعد ما ظلموا} بهجو الكفار لهم في جملة المؤمنين فليسو مذمومين قال الله تعالى: (لا يحب الله الجهر بالسوء من القول إلا من ظلم) وقال تعالى (فمن اعتدى عليكم فاعتدوا عليه بمثل ما اعتدي عليكم) {وسيعلم الذين ظلموا} من الشعراء وغيرهم {أي منقلب} مرجع {ينقلبون} يرجعون بعد الموت.