This is common doubt that is spread through various expressions and formulations.
Shaykh ʿUbayd al-Jābirī (رحمه الله) said:[1]
This is frequently mentioned by the pedantic, plotting, deceiving people of doubts: “Is truth accepted from everybody” and sometimes they express it through their saying: “Take the truth from whoever brings it.”
I say, regardless of whether [this doubt] is [expressed] like this or that:
Firstly: The foundation is that truth is not sought except from the people of truth, and knowledge of the Sharīʿah is not taken except from the people of the legislation, those grounded in knowledge, holding fast to the Sunnah. This is the foundation.
Secondly: Whatever agrees with the Sunnah after being subjected to it [for evaluation], meaning what comes to us from a disbeliever, or an innovator, other than a person of the Sunnah, then it has two states:
The first of them: That it agrees with the Sunnah, so we accept it. The other: What opposes the Sunnah, so we reject it.
Or if you wish, you can say: Acceptance of the truth has two scenarios:
The first: The scenario of seeking and pursuing, making effort and investigating. This is not taken except from a person of the Sunnah, so be astute, the foundation of [those who constitute] the people of legislation (أهل الشرع) are Ahl al-Sunnah.
Here you can say, that the people of the legislation are two types: A type that is the person of Sunnah, so that is our pursuit, and what he has [of knowledge] is what we desire, and the other, even though he is a person of legislation, he is a misguided innovator.
The second of the paths of truth and acceptance: Meaning when a disbeliever or innovator comes with what agrees with the Sunnah, then we accept it. Is this because of that person who came to us with the truth, or because he agreed with the Sunnah? It is due to agreeing with the Sunnah.
01 These doubts come from the people of innovation and ḥizbiyyah those having partisanship to a group, a creed or methodology that opposes the Sunnah. They wish to encourage the people of the Sunnah to take knowledge of the Sharīʿah from the innovators, so as to make inroads into them and to weaken them and to snatch people from them.
02 The Shaykh (رحمه الله) explained that the foundation, when we seek knowledge, meaning when we go out to pursue knowledge, to go to mosques, to travel to acquire knowledge, then we seek it only from the people of the Sunnah. Thus, if we want to study and learn the rulings pertaining to purification, or prayer or Hajj and the likes, or a science among the sciences of the Qurʾān and Ḥadīth, then we seek it only from people of the Sunnah. This is the first situation.
03 The second situation is when, incidentally, in an encounter or when we come across someone or a book or what is along these lines, when something is relayed to us from someone other than a person of the Sunnah, form a disbeliever, or an innovator, then, if what he says or writes or conveys agrees with the Sunnah, then we accept it because it is truth, not because we made that person, or consider that person one from whom truth is sought and acquired.
04 With this particular detail (تفصيل) we establish that indeed, Ahl al-Sunnah take the truth whenever it comes to them and from whomever it comes, but they only seek it with intent and pursue it from the people of the Sunnah.
05 The Shaykh (رحمه الله) also explained that the people of the legislation, those who write and speak about the rulings of the Sharīʿah, among the scholars of Islām, they are of two types. Those who are people of the Sunnah, upon the way of the Salaf, so they are the foundation in this knowledge. We seek it from them as the basis of our learning. And yes, there are scholars of the Sharīʿah among the people of innovation and misguidance or among those affected to one degree or another by the views and statements of the people of innovation and misguidance. They are not the foundation in this knowledge for us but if they have or express the truth in a matter and it is brought to us, then of course, we accept it, because it is the truth.[2]
06 Shaykh ʿUbayd (رحمه الله) went on to give evidence by saying that if a Jew came to us or a Christian, and he said: “In the Torah we read that the heavens are seven and the earths are seven and that Allāh’s command descends between them”, then we would say that this is correct and is supported by the Qurʾān (65:12). And the Shaykh also alluded to the ḥadīth of Ibn Masʿūd (رضي الله عنه) related by al-Bukhārī in Kitāb al-Tafsīr regarding the verse, “They have not made just estimation of Allāh…” (39:67), when a Jew came to Allāh’s Messenger (صلى الله عليه وسلم) and mentioned that Allāh will place the heavens on a finger, the earths on a finger, the trees on a finger, and so on, until the Messenger laughed until his molars were visible and he recited this verse, in confirmation.
07 Finally, it should be mentioned that some of the scholars, such as Shaykh Ibn al-ʿUthaymīn (رحمه الله) held the view that knowledge of what can be said to be a neutral subject, such as the Arabic language for example, that which is not connected to matters of creed or methodology, even these types of knowledge should not be sought and taken from an innovator. And this is because, this serves as a stepping stone, and introduction to other areas of knowledge that he has in which there is deviation, or that deviation may have actually entered into these neutral subjects.