
The code recipe below limits the specified discount codes to one use per “user” (a single username/email address in your WordPress Users list).
If you are using discount codes to give free trials, see this post for a better method to offer trial memberships that can only be used once.