How do I send an automatic email to my WordPress users to let them know that their user role has changed?

Darren Hagen

July 31, 2017

A few weeks ago we developed a site where the client wanted multiple types of customers, each having a different discount volume. We were able to do this simply by creating a few different new user types. They also wanted an automatic email to be sent out whenever a customer type (WP user role) was changed letting their customer know. The following is the code we placed in the theme’s functions.php file to do this.