Wall units are mostly useless, but only mostly.
First off, large quantities of wall units will attract bigger players looking for tks (total kills). I personally love to look for wall because I can kill millions in might and only sacrifice a few t1′s. However, a little amount of wall is useful to stop porters, carts and wagons from easily farming your city/cities. So its alright to vent excess resources into a wall after every other method of spending those resources has been exhausted. You can store resources beyond what you can protect by queueing wall units and canceling the build. Also, you can cancel production of a wall unit to temporarily boost your population, even beyond the population limit, and increase the number of troops you can queue. I like to build small walls to attract attacks when I feel like fighting as well.
My main point is don’t count on walls for protection. Be smart and happy hunting.