Hafetz Haim Halachot
Halacha 116 / 215

Hilchos Lashon Hara chapter 8, section 4

Know that lashon hara is forbidden even about someone who is not learned in Torah (an am ha'aretz), because he too is part of Hashem's people, whom He took out of Egypt. And if the person is a Torah scholar (talmid chacham), the one who speaks lashon hara about him certainly gets a much bigger punishment. Chazal said: "Whoever speaks after the death of a Torah learned person falls into Gehinom." Sometimes it also counts as shaming a Torah scholar, and it is well known how great the punishment for that is.

The yetzer hara (evil inclination) tells a person that the prohibition was only about the Torah scholars of the time of the Gemara, but that it is allowed to shame Torah scholars of today. This is a complete mistake. Every Torah scholar is measured by his own generation. Even in our time, if someone works hard in Torah and is fit to rule on halacha and to teach, he counts as a Torah scholar. Shaming him, even only with words, and even not in front of him, is a sin, and it deserves niddui (being put in excommunication).

And it is all the more serious if the Torah scholar is the rabbi who rules on halacha in the town. Because of the story, people will stop asking him halacha questions. They will decide for themselves, and things will go wrong.