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.
bayhaqi:20346Abū ʿAbdullāh al-Ḥāfiẓ > Abū al-ʿAbbās Muḥammad b. Yaʿqūb > Muḥammad b. ʿAbdullāh b. ʿAbd al-Ḥakam > Ibn Wahb > Sufyān > ʿUbaydullāh b. Abū Yazīd > ʿAbdullāh b. ʿAbbās Idhā Suʾil > Shayʾ

[Machine] "And if it is not in the Book of Allah and the Messenger of Allah ﷺ said it, then he said it, and if it is not in the Book of Allah and the Messenger of Allah ﷺ did not say it, but Abu Bakr and Umar said it, then he said it. Otherwise, he should exert his opinion."  

البيهقي:٢٠٣٤٦أَخْبَرَنَا أَبُو عَبْدِ اللهِ الْحَافِظُ ثنا أَبُو الْعَبَّاسِ مُحَمَّدُ بْنُ يَعْقُوبَ أنبأ مُحَمَّدُ بْنُ عَبْدِ اللهِ بْنِ عَبْدِ الْحَكَمِ أنبأ ابْنُ وَهْبٍ قَالَ سَمِعْتُ سُفْيَانَ يُحَدِّثُ عَنْ عُبَيْدِ اللهِ بْنِ أَبِي يَزِيدَ قَالَ سَمِعْتُ عَبْدَ اللهِ بْنَ عَبَّاسٍ ؓ إِذَا سُئِلَ عَنْ شَيْءٍ هُوَ فِي كِتَابِ اللهِ قَالَ بِهِ

وَإِذَا لَمْ يَكُنْ فِي كِتَابِ اللهِ وَقَالَهُ رَسُولُ اللهِ ﷺ قَالَ بِهِ وَإِنْ لَمْ يَكُنْ فِي كِتَابِ اللهِ وَلَمْ يَقُلْهُ رَسُولُ اللهِ ﷺ وَقَالَهُ أَبُو بَكْرٍ وَعُمَرُ ؓ قَالَ بِهِ وَإِلَّا اجْتَهَدَ رَأْيَهُ