Home/Blog/How to Set Up Two-Factor Authentication on WordPress (2026)

How to Set Up Two-Factor Authentication on WordPress (2026)

WordPress two-factor authentication login protected by an authenticator app code

Your WordPress password alone is no longer enough. Bots hammer wp-login.php with thousands of stolen username and password combinations every day, and if just one matches, your whole site is theirs. WordPress two-factor authentication (2FA) stops that cold: even with the correct password, an attacker still cannot log in without a second code from your phone. Setup takes less than ten minutes.

What Is Two-Factor Authentication?

Two-factor authentication asks for two proofs at login instead of one: something you know โ€” your password โ€” and something you have, usually a six-digit code from an authenticator app on your phone. Both are required. The code changes every 30 seconds, so a stolen password becomes useless on its own.

Most WordPress break-ins do not start with clever hacking. They start with credential stuffing: bots replay passwords leaked from unrelated breaches and hope you reused one. A strong password helps, but it can still be phished or leaked โ€” 2FA closes that gap.

Pick Your Second Factor: App Code, Email Code, or Passkey

Not all second factors are equal. Choose the strongest one your users will actually use.

1. Authenticator App (TOTP) โ€” Recommended

An app like Google Authenticator or Authy generates a six-digit code every 30 seconds. It works offline, needs no email delivery, and is the solid baseline for admin accounts. This is the method most WordPress site owners should start with.

2. Email One-Time Code

A code is sent to your registered email address at login. It needs no app, so it is the easiest option for non-technical users โ€” but it is only as secure as that email account, and it fails if your mail server is slow or down.

3. Passkeys (WebAuthn) โ€” Strongest

Passkeys let you log in with your fingerprint, face, or a hardware key instead of a code. They are the only widely available option that resists phishing, because the credential is tied to your site’s real domain. Use them for your own admin account if your 2FA plugin supports them โ€” our best WordPress security plugins guide compares the plugins that offer this.

How to Set Up Two-Factor Authentication on WordPress

WordPress core still does not ship 2FA โ€” not in 6.x, not in WordPress 7.2 โ€” so you add it with a plugin. The official Two Factor plugin, maintained by WordPress core contributors, is the simplest free route; WP 2FA is the best alternative if you also want passkeys in one plugin.

  1. Install the plugin. In wp-admin, go to Plugins > Add New, search for “Two Factor”, install and activate it.
  2. Open your profile. Go to Users > Profile and scroll to the Two-Factor Options section.
  3. Enable the authenticator app. Click the setup link, scan the QR code with Google Authenticator or Authy, then enter the six-digit code shown to confirm.
  4. Save your backup codes. The plugin shows one-time backup codes โ€” store them somewhere safe and offline, like a password manager. They are your only way back in if you lose your phone.
  5. Test it now. Log out and log back in. You should be asked for the code right after your password. If the code works, 2FA is live.

That is the whole setup for one user โ€” five minutes of work. The next step is making sure every privileged account on the site has it, not just yours.

Scanning a QR code to set up two-factor authentication on WordPress

Make 2FA Mandatory for Admins and Editors

2FA on your own account protects one door. If another administrator logs in with only a password, attackers will find that account instead. In WP 2FA, open the plugin settings and require 2FA for the Administrator and Editor roles, with a short grace period so existing users can set it up. Subscribers do not need it unless your site handles sensitive data. Ignore the grace period and the account locks until the user enrols.

Close the Side Doors 2FA Does Not Cover

Most guides skip this: 2FA plugins protect the login form, not every way into your site. Application Passwords authenticate to the REST API on a separate path, and the legacy XML-RPC endpoint can be abused for brute-force amplification โ€” hundreds of password attempts in a single request. Disable XML-RPC if you do not use it, and delete any Application Passwords you no longer recognise. Remember too that 2FA would not have stopped attacks like the wp2shell chain, which created admin accounts through a REST API flaw without touching the login form โ€” keeping core, themes, and plugins updated is a separate job. If the worst has already happened, read our guide on how to clean a hacked WordPress site.

Test Your Recovery Path Before You Need It

The most common way site owners lock themselves out is not an attack โ€” it is a lost or replaced phone with no backup codes saved. Test the recovery path while you still have access: log out, log in using a backup code, and confirm it works. Store the remaining codes in your password manager.

Common 2FA Mistakes to Avoid

  • Relying on SMS codes only. SMS is the weakest method โ€” security standards classify it as a last resort. Use an app or passkey instead.
  • Skipping the backup codes. No backup codes means a lost phone becomes a locked site and a support ticket.
  • Protecting only one admin. Every administrator and editor account needs 2FA, or attackers will target the unprotected one.
  • Installing nulled security plugins. A pirated plugin can contain a backdoor. Only install security tools from wordpress.org or the vendor’s own site.

Conclusion

WordPress two-factor authentication is the highest-return security change you can make in ten minutes: a free plugin, a phone app, and a set of backup codes turn your login page from the easiest target on your site into a dead end for password attacks. Set it up today, enforce it for every admin and editor, and test your backup codes while you still have access. See what’s new in WordPress 7.2 and browse more free guides on KamiWeb Tools.

Frequently Asked Questions

Does WordPress have built-in two-factor authentication?

No. WordPress core does not ship 2FA or passkey support as of WordPress 7.2. You add it with a free plugin such as the official Two Factor plugin or WP 2FA.

Is two-factor authentication free on WordPress?

Yes. The official Two Factor plugin and WP 2FA both offer TOTP app codes, email codes, and backup codes for free, and passkeys are included in WP 2FA’s free tier.

What happens if I lose my phone with my authenticator app?

Use one of the backup codes you saved during setup to log in, then set up 2FA again on your new phone. If you never saved backup codes, disable the plugin via hosting file access or ask your host for help.