I found this hadith which contradicts other hadiths about the prophet Muhammad (saw) liking poetry and encouraging it. What is the correct ruling?
Narrated Abu Huraira: Allah's Messenger (ﷺ); said, "It is better for anyone of you that the inside of his body be filled with pus which may consume his body, than it be filled with poetry."
Narrations where Prophet Muhammad (s.a.w) allowed poetry:
Narrated Al Bara: The Prophet (ﷺ) said to Hassan, "Lampoon them (i.e. the pagans) and Gabriel is with you."
Narrated Aisha: Once Hassan bin Thabit asked the permission of the Prophet (ﷺ) to lampoon (i.e. compose satirical poetry defaming) the infidels. The Prophet (ﷺ) said, "What about the fact that I have common descent with them?" Hassan replied, "I shall take you out of them as a hair is taken out of dough." Narrated `Urwa: I started abusing Hassan in front of Aisha, whereupon she said. "Don't abuse him, for he used to defend the Prophet (with his poetry).
Narrated 'Abdullah: that the Messenger of Allah (ﷺ) said: "Indeed there is wisdom in (some) poetry."
Ubayy b. Ka’b reported the Prophet (May peace be upon him) as saying : In poetry there is wisdom.
Narrated Abdullah ibn Abbas: A desert Arab came to the Prophet (ﷺ) and began to speak. Thereupon the Messenger of Allah (ﷺ) said: In eloquence there is magic and in poetry there is wisdom.
So in the first hadith it seems like poetry isn't something one should fill his body with, while in the other it says poetry has its wisdoms. How shall we understand these hadiths without feeling they contradict each other?