ʿAli was told that Ibn ʿAbbas did not see any harm in the Mut'a marriage. ʿAli said, "Messenger of Allah ﷺ forbade the Mut'a marriage on the Day of the battle of Khaibar and he forbade the eating of donkey's meat." Some people said, "If one, by a tricky way, marries temporarily, his marriage is illegal." Others said, "The marriage is valid but its condition is illegal."
إِنَّ رَسُولَ اللَّهِ ﷺ نَهَى عَنْهَا يَوْمَ خَيْبَرَ وَعَنْ لُحُومِ الْحُمُرِ الإِنْسِيَّةِ وَقَالَ بَعْضُ النَّاسِ إِنِ احْتَالَ حَتَّى تَمَتَّعَ فَالنِّكَاحُ فَاسِدٌ وَقَالَ بَعْضُهُمُ النِّكَاحُ جَائِزٌ وَالشَّرْطُ بَاطِلٌ