These lines are attributed to Imām Shāfiýi:

wa lā tuúţiyanna'r ra’ya man lā yurīduhū
fa lā anta maĥmūdun, wa la'r ra’yu nafiýuhu

Offer not your advice or opinion to those who do not ask,
For neither shall you be liked, and nor will it be of any use.

Dīwān ash-Shāfiýī p.274; Manāqib ash-Shāfiýī of al-Bayhaqī 2/97; Manāqib ash-Shāfiýī of Fakhr ar-Rāzī p.276,
ādāb ash-Shāfiýī wa Manāqibuhu of Fakhr ar-Rāzī p.276; Shiýr al-Fuqahā p.362