WordPress/two-factor

Email Template custormisation

Closed this issue · 3 comments

Is your enhancement related to a problem? Please describe.

Hi,

I am building a website that has public pages and membership pages.

For members' logins, Two-factor has been used. But as their age group is bit high.. the code is bit hard for them to read.

Is there any way I can customise the email template?

Proposed Solution

It would be great if we can customise the email template.

Is there any way to do it?

Designs

No response

Describe alternatives you've considered

No response

Please confirm that you have searched existing issues in this repository.

Yes

I am in a similar situation and would love a filter for customizing the email – similar to the hooks WordPress provides for other emails. Such as wp_new_user_notification_email, email_change_email, etc.

dd32 commented

The email templates used by the Email-based 2FA can be customized through these filters:

  • two_factor_token_email_subject
  • two_factor_token_email_message

See the code for the documentation of what is passed:
https://github.com/WordPress/two-factor/blob/master/providers/class-two-factor-email.php#L219-L243

Awesome, thanks!