I almost hate to post this here, not knowing who you are or what people will think of me! But these pieces of advice was given to me at a Lactation Support Group about 5 years ago after my baby had done the same to me (there were Lactation Nurses there supervising).
If the baby nips, do not respond by yelping - hard as that is and especially with older children (12 months +).
Option 1:
Immediately finger release the nipple from their mouth, look them in the eye and firmly say "no" then discontinue that breast. Offer a bottle if necessary. Sometimes it is play, sometimes it is teething. This worked for my 3rd child, but not my fourth.
Option 2:
Another suggestion if Option 1 did not work was to gently press the baby into your breast as they were biting you (vs. yelping but totally against your instincts). NOT TO SMOTHER - just 1-2 seconds - this distracts the baby from biting/eating/teething as their natural instinct to this is to be able to breathe freely so they will open their mouth or push away from you. It's similar to blowing into a child's face when you are teaching them to hold their breath at swim lessons - then firmly say "no biting" and continue breastfeeding. 2 strikes - you are out for that feeding. This worked for my 4th.