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:
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.