مَنْ تَعَلَّمَ عِلْمًا مِمَّا يُبْتَغَى بِهِ وَجْهُ اللَّهِ لَا يَتَعَلَّمُهُ إِلَّا لِيُصِيبَ بِهِ عَرَضًا مِنَ الدُّنْيَا، لَمْ يَجِدْ عَرْفَ الْجَنَّةِ يَوْمَ الْقِيَامَةِ
Translation: Whoever learns knowledge that ought to be sought for Allah’s pleasure solely to obtain a worldly benefit will not find the fragrance of Paradise on the Day of Resurrection.
Source: أبو داود
مِمَّا يُبْتَغَى بِهِ وَجْهُ اللَّهِ describes knowledge properly sought for Allah’s pleasure. لَا ... إِلَّا is a restricting pattern: “only ... for.” عَرَضًا مِنَ الدُّنْيَا means a temporary worldly gain, and عَرْفَ الْجَنَّةِ is the fragrance of Paradise.
The warning concerns making worldly gain the sole aim of religious learning. Receiving an appropriate salary for teaching or undertaking paid work is not automatically identical with that intention; the distinction involves sincerity, integrity in service, and whether religious knowledge is reduced to a mere vehicle for status or profit.