Docs

Email codes and backup codes

5 min readUpdated November 19, 2026

Shield has two fallback ways to pass the 2FA step: email codes, which every user has, and backup codes, which are a set of single-use codes for emergencies.

Email codes#

An email code is a 6-digit one-time code that Shield sends to the email address on the user’s account.

How they work

  • They are always on. They are the baseline method for every user in the roles that 2FA applies to. You can’t turn them off.
  • A user with nothing else gets the code automatically. When they enter their password, Shield emails the code and shows the challenge page, which says “We emailed a 6-digit code to” followed by a masked address.
  • A user with an authenticator app or passkey doesn’t get one automatically. The challenge page offers Email me a code if they want one.
  • The email uses your branding. See “How 2FA works” for the Email branding settings.

The rules for a code

RuleValue
Length6 digits
Lifetime10 minutes
ResendOnce every 60 seconds
Wrong attempts5 per code, then it is discarded
UseOne time only

Once a code has been sent, the link reads Email me a new code and counts down the resend wait. Requesting a new code replaces the old one.

The code email

The email shows the code in a highlighted box, with your sender name, logo and colors. The code box is always shown. The default subject is “Your [site name] verification code”. You can change the subject, heading and message under Email branding on the Settings tab.

A settings form for email branding shows fields for sender name, sender email, logo upload, accent and header color pickers, footer text, and a toggle for a credit link. Each section includes instructional text on how to configure the sender identity and email appearance.

If the email doesn’t arrive

  1. Check spam or junk.
  2. Wait for the 60-second countdown and click Email me a new code.
  3. Use a backup code, if you have one.
  4. If email never works on your site, fix delivery. A WordPress SMTP plugin usually solves it. Use the Send test button in Email branding to check.
  5. As a last resort, an administrator can add define( 'NAHNLS_DISABLE_2FA', true ); to wp-config.php. See “How 2FA works”.

If Shield can’t send the email at all, the challenge page says: “We could not send the verification email. Use “Email me a code” below to try again, or enter a backup code.”

Why email alone is the weakest option

If a user’s email is the only second factor, anyone who can read that inbox can pass it, and a site whose email is down locks those users out. Encourage administrators in particular to add an authenticator app. See “Set up an authenticator app”.

Backup codes#

Backup codes are for when the user’s usual method isn’t available, for example a lost phone.

How they work

  • A user gets 8 codes when they add their first authenticator app or passkey. Shield shows them once, and the user should copy them and keep them somewhere safe, such as a password manager.
  • Each code looks like XXXXX-XXXXX.
  • Each code works once. After it is used, it is gone.
  • Shield stores only a scrambled form of each code, so it can’t show them again.
  • Regenerating makes a new set of 8 and invalidates all the old ones.

A user with only email codes has no backup codes until they click Get codes on the Backup codes row of their Login & security page, or add a stronger method.

The Two-factor authentication card for a user with only email codes. Email code shows Always on, Passkey shows Not set up, Authenticator app has a Set up button and Backup codes has a Get codes button, with a tip to set up an authenticator app.

Use a backup code at sign-in

  1. Enter your username and password.
  2. On the challenge page, click Use a backup code.
  3. Type the code in the Backup code box.
  4. Click Verify.

The Use a backup code link only appears for users who still have codes left.

Check how many are left

  • Users see it on their Login & security page.
  • Administrators see “Backup codes left” for each user in the status overview at the bottom of the 2FA tab. The number turns red at two or fewer.

Make new codes

  1. Go to Login & security. See “The Login & security page for users”.
  2. On the Backup codes row, click New codes (or Get codes if you have none).
  3. Enter your password when asked (“Confirm your password to continue”). The prompt warns: “Each code works once. Regenerating invalidates your existing codes.”
  4. Copy the new codes and keep them somewhere safe.

Regenerate before you run out, and as soon as you’ve used a code to recover access.

When a user loses access#

SituationWhat to do
Lost phone, still has backup codesSign in with a backup code, then reconfigure the authenticator app.
Lost phone, no backup codes, email worksClick Email me a code on the challenge page.
Lost phone, no backup codes, email failsAn administrator resets their 2FA (below).
Administrator locked out, no emailUse NAHNLS_DISABLE_2FA in wp-config.php. See “I locked myself out”.

Reset a user’s 2FA (administrators)

  1. Go to Users and open the user’s profile.
  2. Find the Reset 2FA row and click Reset 2FA.
  3. Confirm the prompt.

This removes the user’s authenticator app, passkey method and backup codes. Passkeys the user registered are not deleted; remove those under Passkeys on the same profile. They then verify with email codes and can set everything up again.

The Reset 2FA row only appears when the user has an authenticator app, a passkey method or backup codes.

The Passkeys and Two-Factor Authentication sections on another user's profile, as an administrator sees them: a Registered passkeys table, the 2FA status (Active, with an authenticator app and email code), a Regenerate backup codes button and a Reset 2FA button.

Failed attempts#

Wrong codes count. After 5 wrong codes on one login, the challenge is cancelled and the IP is locked out for 15 minutes. See “How 2FA works”.

Troubleshooting#

  • “Incorrect code. N attempts left.”: the code is wrong or expired. Request a new email code.
  • “If you just used this code to set up the app, wait for the next one.”: an authenticator code can only be used once. Wait for the next one.
  • No “Use a backup code” link: the user has no backup codes left, or never had any.
  • “Please wait a moment before requesting another code.”: you asked within the 60-second window. Wait for the countdown.

Was this helpful?

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only