Touching the wall can reduce the charge accumulated on the body surface.
But if the skin is dry and the wall is dry, the effect of eliminating static electricity will be reduced.
If the touch time is longer and the contact area is larger, the effect will be better. But it won't take long. Touching for a second or two is enough.
There is another reason why touching a wall releases static electricity more easily than touching a metal object. The resistance of the wall is greater than that of the metal, and the discharge intensity between the hand and the wall will be less than that between the hand and the metal, so "electrostatic slapping" is not easy to occur.