Use a water spray bottle - No one, including [children], like to be squirted with water, so you can try a quick spritz at your [child] if they are somewhere or doing something they shouldn't be.
Respectfully, this advice is absolutely idiotic. If your toddler pees their pants, do you rub their face in it too?
I'm not a proponent of treating children identically to adults, but children should still be afforded some aspects of human dignity. Spraying them with a water bottle like a malfeasant feline is not a polite way to treat anyone, regardless of age.
If you do this to your child, you are teaching them that this is an acceptable way to treat people that bother them. If you do not end up with an egocentric and inconsiderate child after subjecting them to this, it will be from pure luck.