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.
The Code Recipe
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
Update the array on line 10 with the discount code(s) you would like to restrict to one time per user.
Free Course: Membership Site Development—The Basics
Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.