Home Knowledge Base WP 2FA How to change the email templates & text in WP 2FA

How to change the email templates & text in WP 2FA

WP 2FA can send 2FA-related emails to users, depending on their setup and actions. For example, WP 2FA may send emails when:

  • A user requests a login link
  • A user requests a one-time login code via email
  • A user sets up 2FA via email
  • A user requests backup codes
  • A user account is locked (because they did notย configure 2FA within the grace period)
  • A user account is unlocked
  • A user requests a password reset code

Changing the WP 2FA plugin email templates

To configure email settings and templates:

  1. Log in to your WordPress dashboard.
  2. Go to WP 2FA > White labeling.
  3. Click Customize emails & SMS templates.

This page includes three tabs with the following options:

  • Email Settings
    • Change the email address the plugin should use as a from address
    • Email delivery test
  • Email Templates
    • Change the subject of the email
    • Change the email text
    • Disable / re-enable specific email templates
  • SMS Templates
    • Edit SMS registration text
    • Edit SMS code text
Note: Email and SMS template editing is available with the Enterprise plan. You can review all white labeling option in our customization guide.

What are the template tags?

Template tags are placeholders that WP 2FA replaces with dynamic information when the email is sent.

Available template tags include:

  • {site_url} โ€” Adds the website URL configured in WordPress.
  • {site_name} โ€” Adds the website name configured in WordPress.
  • {grace_period} โ€” Adds the configured 2FA grace period.
  • {user_login_name} โ€” Adds the userโ€™s login name.
  • {user_first_name} โ€” Adds the userโ€™s first name.
  • {user_last_name} โ€” Adds the userโ€™s last name.
  • {user_display_name} โ€” Adds the userโ€™s display name.
  • {login_code} โ€” Adds the 2FA login code or login link.
  • {2fa_settings_page_url} โ€” Adds the URL to the userโ€™s 2FA settings page.
  • {user_ip_address} โ€” Adds the IP address from which the 2FA request originated.
  • {admin_email} โ€” Adds the site administrator email address.
  • {wp_admin_email} โ€” Adds the WordPress administrator email address.
  • {backup_codes} โ€” Adds the list of backup codes.

Therefore, in the example below, the tags will be replaced with actual values when sent to the user. Instead of the tag {site_url} the plugin will insert the URL of the website, instead of the {grace_period} the plugin will insert the configured value, for example 3 days, instead of the {user_login_name} the plugin will insert the first name of the user, for example, Robert.

Note: the email template editor is a fully blown editor and the emails are in HTML format. Therefore it is very easy to update the template to match your businessโ€™ branding.

Customizing the โ€œfromโ€ email address and display name

By default, our plugin uses your site’s admin email address and name. These can be found under the General Settings in your WordPress dashboard.

To change the โ€œfromโ€ email address:

  1. Go to WP 2FA > White labeling.
  2. Click Customize emails & SMS templates.
  3. Open the Email Settings tab.
  4. Under From email & name, select one of the available options:
    • Use the email address โ€“ uses the email address configured in WordPress.
    • Use another email address โ€“ allows you to enter a custom sender email address and name.
  5. Click Save settings.

Close the CTA
Were you able to find what you were looking for?