I think my friend in AZ recently had an experience with the police for standing on the pegs while riding. His recant of the situation is far better than mine.
I recall back in the '80's when I got my MC license, there was a test question about riding over road debris. Specifically , a loose muffler in the road and it was unavoidable. It suggested to stand on the pegs, ride over the debris, then pull over to inspect your bike. -- but that was many moons and beers ago.
I tend to ride on the street and stand when I need to stretch, see over traffic, show my ass to the vehicle I just passed for being to damned slow, or see that road sign on the right that is partially blocked by cars.
As I was recently bored, I tried to find it on various DMV sites... I cant find anything on a motorcycle test booklet that states 'do not stand up while riding'. but I didn't look in depth for it. I did find it odd that some law enforcement officials can tell you that it is illegal to stand while riding, the booklet tells you to 'rise up slightly', and we all know you stand on the pegs for various reasons. So long as I am not standing on the fuel tank (stunting), whats the big deal?
Foremost Motorcycle insurance has this on their site:
Hold onto the hand grips tightly.
Keep a straight course.
Rise up slightly on the foot pegs to absorb the shock.
NY DMV section:
Watch for uneven surfaces such as bumps, broken pavement, potholes, or small pieces of highway trash.
Try to avoid obstacles by slowing or going around them. If you must go over the obstacle, first, determine if it is possible. Approach it at as close to a 90º angle as possible. Look where you want to go to control your path of travel. If you have to ride over the obstacle, you should:
Slow down as much as possible before contact.
Make sure the motorcycle is straight.
Rise slightly off the seat with your weight on the footpegs to absorb the shock with your knees and elbows, and avoid being thrown off the motorcycle.
Just before contact, roll on the throttle slightly to lighten the front end.
If you ride over an object on the street, pull off the road and check your tires and rims for damage before riding any farther.