Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Explainers · Explainer

What Is Two-Factor Authentication? A Plain Explanation

What Is Two-Factor Authentication? A Plain Explanation

Short answer

Two-factor authentication, or 2FA, asks for a second proof of identity after your password before letting you into WordPress. You enter your password, then a six-digit code from an authenticator app, a code sent by email, or a security key. It blocks logins even when the password has been stolen, and WordPress supports it through a plugin.

Key takeaways

  • Two-factor authentication adds a second login check after your password, such as a code from your phone.
  • Authenticator app codes change every 30 seconds and are the recommended method for most users.
  • Always generate and store the 10 backup codes, or a lost phone can lock you out.
  • WordPress core has no built-in 2FA; you need a plugin such as the official Two Factor plugin.
  • The official plugin cannot force users to enable 2FA, but WP 2FA can enforce it by role.
  • Security keys and passkeys are the strongest second factor for admin accounts.

What is two-factor authentication?

Two-factor authentication, or 2FA, asks for a second proof of identity after your password before letting you into WordPress.

A password alone is one factor: something you know. The second factor is something you have, such as your phone, or something you are, such as a fingerprint. An attacker who steals your password still cannot log in without that second factor.

The Two Factor plugin on WordPress.org describes it plainly: it adds an extra layer of security to your WordPress login by requiring a second form of authentication in addition to your password (Two Factor).

That second check helps protect against unauthorized access even if passwords are compromised. Password leaks and automated guessing are among the most common ways WordPress sites are broken into, as explained in our guide to whether WordPress is secure.

How does two-factor authentication work?

You log in with your username and password, then WordPress asks for a second check before opening the dashboard.

The flow has three steps. First, you enter your normal login details.

Second, WordPress asks for the second factor, such as a six-digit code from an app on your phone. Third, once the code checks out, you are logged in as usual.

The code from an authenticator app changes on a schedule. The Make WordPress guide to configuring two-factor authentication explains that time-based one-time passwords are temporary codes generated by an authentication app, and that these codes change every 30 seconds (Configuring Two-Factor Authentication).

Because the code expires so fast, a stolen code is useless within seconds. WordPress.com's own support guide puts the idea the same way: two-step authentication requires you to know something, your password, and to possess something, your phone or a security key (Enable two-step authentication).

What are the types of second factors?

WordPress supports several second factors, and they differ in security and ease of use.

The Two Factor plugin lists four providers: an authenticator app using time-based one-time passwords, codes sent by email, backup codes for emergencies, and a dummy method that only works when debugging is on (Two Factor).

The same page rates the authenticator app as high security and recommends it for most users, while email codes and backup codes are rated medium security.

MethodHow it worksSecurityBest for
Authenticator app (TOTP)Six-digit code in an app, changes every 30 secondsHighMost users
Email codesOne-time code sent to your emailMediumUsers without a phone app
Backup codesTen one-time codes printed in advanceMediumEmergency access
Security key or passkeyHardware key or device biometricsHighAdmins and high-value accounts

Security keys deserve a note. The Two Factor plugin's older FIDO U2F support was deprecated and removed due to loss of browser support, but a separate WebAuthn provider plugin adds security keys and passkeys as a second factor (Two Factor). Our guide to what a passkey is explains how passkeys differ from passwords.

How do you set up two-factor authentication on WordPress?

Each user sets up 2FA on their own profile, after an admin installs a 2FA plugin.

WordPress core does not include two-factor authentication, so you need a plugin. The official Two Factor plugin is the simplest choice, and WP 2FA is a common alternative with role-based enforcement. Install and activate the plugin from “Plugins > Add New”, then follow the setup on your profile.

The Two Factor plugin page gives the steps: go to “Users > Your Profile” in the WordPress admin, scroll to the “Two-Factor Options” section, and enable one or more methods (Two Factor).

Then configure each method, pick a primary method, and click “Update Profile”. For the authenticator app, you scan a QR code with an app such as Google Authenticator, Authy, or 1Password, then type the six-digit code it shows to confirm the link.

Each user must do this for their own account. An admin cannot set up the authenticator app for someone else, because the secret lives on that person's phone. Admins can, however, configure 2FA for other users by editing their profiles, according to the same plugin page (Two Factor).

What are backup codes and why do you need them?

Backup codes are one-time codes you print or save before you need them, so a lost phone does not lock you out.

The Two Factor plugin generates 10 backup codes for emergency access, and its page stresses that you should always enable backup codes to prevent being locked out of your account (Two Factor).

The WordPress.org account guide gives the same advice for wordpress.org accounts: generate and print backup codes, because losing your device without a backup code could permanently prevent you from accessing your account (Configuring Two-Factor Authentication).

Store the codes somewhere safe and offline, such as a printed sheet in a drawer or a password manager. Each code works once, and the plugin generates a fresh set of 10 when you ask for new ones. If you use all 10, generate a new set right away.

What happens if you lose your second factor?

Use a backup code first, and if you have none, ask a site administrator to reset your 2FA.

The plugin page states that if you lose access to all authentication methods, you should contact your site administrator, and that an admin can open “Users > All Users”, edit your profile, and uncheck every enabled method to remove 2FA from the account (Two Factor).

The same reset is possible from the command line with wp two-factor disable --yes, which performs a full reset of the user's 2FA.

If you are the only admin and you are locked out, the recovery path is harder. You can delete the plugin folder over FTP or hosting file manager to remove the 2FA check, then log in with your password alone and set 2FA up again.

That is why our guide to recovering a hacked WordPress admin account stresses keeping a second admin account and a tested backup.

If you are locked out for any reason, see our guide to fixing being locked out of wp-admin first.

Should you require two-factor authentication for all users?

Yes for admins, and ideally for every user who can publish, but the official plugin cannot enforce it on its own.

The Two Factor plugin page is candid about this: there are no built-in enforcement settings, and no native enforcement support yet, though developers can use filters to control which providers are available per user or role (Two Factor).

The WP 2FA plugin takes the other approach and lets you enforce 2FA for all users or for specific roles (WP 2FA).

For a small site, requiring 2FA for administrators and editors is a good start. Customers and subscribers, who cannot change site content, matter less.

On a multisite network, the Two Factor plugin works across the network, and each user's settings follow their account to every site, but there are no network-wide settings, so a super admin cannot enforce 2FA globally from the Network Admin dashboard (Two Factor).

What mistakes should you avoid?

The most common mistakes are setting up 2FA without backup codes, using email codes as the only method, and leaving admin accounts unprotected.

Skipping backup codes is the costliest error. A phone that is lost, reset, or replaced takes your authenticator app with it, and without backup codes you are locked out until an admin resets your account. Generate the 10 codes the moment you enable 2FA, and store them somewhere you can reach without your phone.

Email codes are better than no second factor, but they are only as safe as your email account. If an attacker can read your email, they can read your codes too. Use the authenticator app as your primary method and keep email codes as a fallback, not the other way around.

Finally, do not protect only your own account. Every admin account is a way into the site, so check that each one has 2FA turned on. Pair 2FA with the other basics in our guide to adding security headers to WordPress.

The WordPress security handbook puts updates first: keeping WordPress itself and all installed plugins and themes up to date is the most important thing you can do for security (Security).

Frequently asked questions

Does WordPress have two-factor authentication built in?

No, WordPress core does not include two-factor authentication, so you need a plugin. The official Two Factor plugin is free and covers authenticator apps, email codes, and backup codes. Alternatives such as WP 2FA add role-based enforcement and passkey support.

Which two-factor method is best for WordPress?

An authenticator app is the best choice for most people: it works offline, the code changes every 30 seconds, and it does not depend on your email account. A security key or passkey is even stronger for admin accounts. Use email codes only as a backup method, not as your main one.

What do I do if I lose my phone with the authenticator app?

Use one of your backup codes on the login screen to get in, then set up a new authenticator app and generate fresh codes. If you have no backup codes, a site administrator can remove 2FA from your profile, or run wp two-factor disable from the command line, and you can set it up again.

Can I force all users on my site to use two-factor authentication?

The official Two Factor plugin cannot enforce 2FA by itself, but you can require it with the WP 2FA plugin, which enforces 2FA for all users or specific roles. On a multisite network, each user's 2FA settings follow their account across sites, but there are no network-wide enforcement settings.

Is SMS two-factor authentication safe for WordPress?

Yes, SMS codes are one option: WordPress.com's SMS option sends a 7-digit code by text message. They are weaker than app codes because they depend on your phone number and mobile signal. Authenticator apps and security keys are stronger and work without a mobile signal. If SMS is your only option, it is still better than no second factor.

Sources

  1. Two Factor WordPress.org
  2. Configuring Two-Factor Authentication Make WordPress
  3. WP 2FA – Two-factor authentication for WordPress WordPress.org
  4. Enable two-step authentication WordPress.com Support
  5. Security WordPress Developer Resources

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.