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:33:1In the name of Allah, the Entirely Merciful, the Especially Merciful.

O Prophet, fear Allah and do not obey the disbelievers and the hypocrites. Indeed, Allah is ever Knowing and Wise.  

O Prophet! Fear God, remain in fear of Him, and do not obey the disbelievers and the hypocrites, ˹and so follow them˺ in what contravenes your Law. Truly God is Knower, of what will happens before it happens, Wise, in what He creates.
القرآن:٣٣:١بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ

يَا أَيُّهَا النَّبِيُّ اتَّقِ اللَّهَ وَلَا تُطِعِ الْكَافِرِينَ وَالْمُنَافِقِينَ ۗ إِنَّ اللَّهَ كَانَ عَلِيمًا حَكِيمًا  

{يا أيها النبي اتق الله} دم على تقواه {ولا تطع الكافرين والمنافقين} فيما يخالف شريعتك {إن الله كان عليما} بما يكون قبل كونه {حكيما} فيما يخلقه.