Rabia’ ibn Sulayman reported: Imam al-Shafi’i, may Allah have mercy on upon him, said, “If you find something in my writings that contradict the Sunnah of the Messenger of Allah, peace and blessings be upon him, then speak with the Sunnah of the Messenger of Allah and abandon what I have said.”
Source: Maʻrifat al-Sunan wal-Āthār 454
عَنِ الرَّبِيعِ بْنِ سُلَيْمَانَ عَنِ الإِمَامِ الشَّافِعِيِّ رَحْمَةُ اللهِ عَلَيْهِ أَنَّهُ قَال إِذَا وَجَدْتُمْ فِي كِتَابِي خِلَافَ سُنَّةِ رَسُولِ اللَّهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ فَقُولُوا بِسُنَّةِ رَسُولِ اللَّهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ وَدَعُوا مَا قُلْتُ
1/217 معرفة السنن والآثار للبيهقي