Often, rice is in salt dispensers to prevent moisture from making the salt become clumpy and possibly get stuck in a shaker.
What else can be used to get the same effect?
You can use dried parsley leaves to prevent moisture. Fill up 1/4 of the shaker and then put in the salt. You can also put in toothpicks, which will have the same effect. I prefer broken ones, but they have to be cleanly broken. One last method I know of is to use dry beans. I've done it with black beans, but I believe other types will work too.
We use orzo. It's a kind of pasta which is shaped like a slightly flattened grain of rice. It is a little longer than long-grain rice, and more importantly it is notably wider than a grain of rice, so it should not come out of your salt shaker accidentally. It is cheap, lasts forever, and available in multi-color which can be decorative if you have a clear salt shaker.
My first salt grinder, a Peugeot, clogged up just a few weeks after purchase. It still had the salt that came with the grinder.
I placed it in a narrow cup-like plastic container, not much wider than the grinder itself and inside the container I placed a couple of unopened sachets of silica gel. It seems to have cleared out the clogging to a large extent.
I suppose you could also fill such a narrow container with some rice and store the mill in it. The rice/silica gel gets to do its work effectively because it's right next to the grinder mechanism and there's no chance of getting any in your food.
Salt absorbs moisture so at humid times this problem can occur. Alternatives to rice could be millet or quinoa or other grains large enough to not fall through the holes for the salt.
A study on water absorption characteristics of the selected cereal grains was conducted. It was found that well dried maize, sorghum and millet grains take about 96, 48 and 24 h, respectively, to reach their water absorption capacities (water absorption saturations). Millet had the highest rate of water absorption as well as the total water absorbed. The rate of water absorption in sorghum was higher than in maize but maize grains imbibed more water than sorghum.
This question has an answer that's totally different, but I find it works quite well: place salt and other clumping spices in a sealed box or bag with a cheap calcium chloride dehumidifier packed/box. You can't use silica, because it reaches equilibrium and stops doing anything, while calcium chloride will work for a while even after it has totally liquified. The effect is strong enough that it will restore a salt shaker that has already clumped. The obvious disadvantage is that it's annoying to store your salt in a sealed container, but you could probably get away with keeping the salt in there two days out of each week.