How to add custom user role(s) to enforce 2FA by email

If you want to add custom user role(s) to enforce 2FA by email using Shield, this is how you can do that:
https://gist.github.com/paulgoodchild/c39c1ee72bfdcdbd705362cdcc140757

The most common place people put this code is in their functions.php file in their theme, but you can put it anywhere as long as it's executed early.

Important: After using this WordPress filter the user interface selection options wont change. This programmatically updates the underlying options that are enabled, and you will see no visible indicators on the UI of this.

If you'd like to offer 2FA/MFA to your customers and clients in your frontend website or customer area, you can use a shortcode. For more details on this, read this article here