How to Set Up Two-Factor Authentication on WordPress (Step by Step)
Passwords get stolen, leaked, and guessed every day. If your WordPress admin account relies on a password alone, you are one credential breach away from losing your site entirely. Two-factor authentication (2FA) adds a second verification step that an attacker cannot easily bypass even when they have your password. This guide walks through why password-only login is insufficient, compares the leading WordPress 2FA plugins, and gives you a clear, step-by-step path to securing every privileged account on your site.
Why Password-Only Login Is Not Enough
The average WordPress site faces hundreds of login attempts every week. Automated bots cycle through leaked credential databases, trying username and password combinations at scale. The problem is structural: a password is a single factor – something you know. Once an attacker knows it, too, they are in.
Common attack paths that bypass even strong passwords:
- Credential stuffing: Attackers buy leaked credentials from data breaches and test them against your login page. If you reused a password anywhere, this works.
- Phishing: A convincing fake login page captures your credentials. You type them in, never knowing the difference.
- Keyloggers and malware: Malicious software on your device records every keystroke, including your admin password.
- Brute force: Without a lockout mechanism, short or common passwords fall quickly to dictionary attacks.
Two-factor authentication does not make phishing or malware impossible, but it dramatically raises the cost of a successful attack. Even with your password, an attacker needs your phone, hardware key, or backup code to get in. Most opportunistic attackers move on to easier targets. Pair 2FA with strategies like hiding your WordPress login URL from hackers for a stronger combined defense.
WP 2FA vs Two-Factor vs miniOrange: Which Plugin to Use
Three plugins dominate WordPress 2FA. Each takes a different approach to configuration, enforcement, and supported authentication methods. Here is a side-by-side comparison:
| Feature | WP 2FA | Two-Factor | miniOrange |
|---|---|---|---|
| Free tier | Yes (core features) | Yes (fully free) | Yes (limited) |
| TOTP (Authenticator app) | Yes | Yes | Yes |
| Email OTP | Yes | Yes | Yes |
| Hardware key (FIDO2/WebAuthn) | Pro only | Yes (built-in) | Pro only |
| Backup codes | Yes | Yes | Yes |
| Force 2FA by role | Yes (core feature) | No (manual per user) | Yes (Pro) |
| Grace period for users | Yes (configurable) | No | Yes (Pro) |
| WooCommerce customers | Yes (Pro) | No native support | Yes (Pro) |
| Setup wizard | Yes | No | Yes |
| White-label | Pro only | No | Pro only |
WP 2FA is the best choice for most site owners who need role-based enforcement with a guided setup. The free version covers TOTP and email OTP for all users and lets you mandate 2FA for specific roles – exactly what a professional site needs.
Two-Factor is the right choice if you want a lean, code-reviewed plugin with no upsell and hardware key support out of the box. It lacks role enforcement in the free version, which makes it less practical for multi-user sites.
miniOrange covers enterprise SSO scenarios and integrates with identity providers such as Okta and Azure AD. If your site is part of a wider identity management setup, miniOrange is worth evaluating. For a standard WordPress install, it adds more complexity than most sites need.
Recommendation: Use WP 2FA for most WordPress sites. The rest of this guide uses WP 2FA as the reference implementation, with notes on differences where they matter.
Setting Up TOTP with Google Authenticator or Authy
TOTP stands for Time-based One-Time Password. Your authentication app generates a six-digit code every 30 seconds using a shared secret established during setup. The code is valid only for that 30-second window, and the server verifies it without ever transmitting your credentials over the network.
Step 1: Install and Activate WP 2FA
Go to Plugins – Add New in your WordPress dashboard, search for WP 2FA, and click Install Now, then Activate. The plugin launches a setup wizard on first activation. You can run through it immediately or skip to the settings page.
Step 2: Choose Your Authentication Methods
In the wizard (or under WP 2FA – Settings), select which methods to enable. For most sites, enable both One-time code via authenticator app (TOTP) and One-time code via email. TOTP is more secure; email OTP is a fallback for users who have not set up an app.
Step 3: Set Up Your Own 2FA (Admin Account)
After saving the settings, click your username in the top right and go to Profile – Two-factor Authentication. Click Set up authenticator app. A QR code appears on screen.
Open Google Authenticator or Authy on your phone. Tap the plus icon and select Scan a QR code. Point your camera at the QR code in WordPress. The app adds an entry labeled with your site name. Type the six-digit code showing in the app into the WordPress confirmation field and click I am ready. Your admin account now requires TOTP on every login.
Step 4: Save Your Backup Codes Immediately
Before leaving the profile page, download or copy the backup codes. These are single-use codes that let you log in if you lose access to your authenticator app. Store them in a password manager or print them and keep them somewhere physically secure. Do not store them in the same place as your password.
Forcing 2FA for Admin and Editor Roles
Enabling 2FA on your own account is a good start, but the goal is to require it for every account that can cause damage if compromised. On a WordPress site, that means at minimum administrators and editors. Understanding WordPress user roles and what access each one carries helps you decide which roles to enforce 2FA on.
In WP 2FA, go to WP 2FA – Settings – Enforcement. You will find a section labeled Require 2FA for the following roles. Check Administrator and Editor. You can also check Author if authors have publishing rights.
Set a grace period – the number of days existing users have to set up 2FA before they are locked out of the dashboard. A grace period of three to seven days is reasonable for most teams. New users added after this setting is saved are required to set up 2FA on their first login, with no grace period.
When an enforced user logs in without 2FA configured, they are redirected to a mandatory setup page. They cannot access the dashboard or front end until they complete setup. This enforcement applies to the WordPress login form, XML-RPC, and application passwords unless you specifically exempt those entry points.
Enforcing 2FA at the role level is more reliable than relying on users to opt in voluntarily. A single unprotected admin account is enough to compromise an entire site.
Backup Codes and Emergency Access
Every user who enables 2FA should generate backup codes before they need them. Backup codes are the safety net for situations where the authenticator app is unavailable: a lost phone, a new phone without app migration, a dead battery during a deadline.
In WP 2FA, users can regenerate backup codes from their profile page under Two-factor Authentication – Backup codes. Each code is single-use. Once used, it is invalidated. Generating a new set invalidates all previous codes.
Emergency Access for Admins
If you are locked out of your admin account and have no backup codes, you have a few recovery paths:
- WP-CLI: Use WP-CLI to reset the 2FA meta for your user directly in the database. The specific meta key varies by plugin.
- phpMyAdmin or direct database access: Delete the usermeta rows that store the 2FA secret and enforcement status for your user ID. This disables 2FA for that account.
- File Manager / SSH: Deactivate the 2FA plugin by renaming its folder in
wp-content/plugins/. Log in without 2FA, generate new backup codes, then reactivate the plugin.
Document the recovery procedure for your site before you need it. Include it in whatever runbook or emergency procedure document your team maintains.
2FA for WooCommerce Customer Accounts
Customer accounts in WooCommerce are WordPress user accounts with the subscriber role. Standard WordPress 2FA plugins enforce 2FA on the WordPress login form, but WooCommerce customers typically log in through a separate My Account page that uses its own form.
The WP 2FA Pro version includes a dedicated WooCommerce integration that:
- Shows the 2FA setup prompt on the WooCommerce My Account page after a customer logs in
- Allows customers to manage their 2FA settings from My Account rather than wp-admin
- Optionally enforces or incentivizes 2FA setup for the subscriber role without requiring admin access
If you do not need to enforce 2FA for customers – only for staff – the free version of WP 2FA is sufficient. Exclude the subscriber role from enforcement in the settings, and customers will not be prompted.
For stores where customer accounts hold sensitive order history or subscription data, requiring 2FA for subscribers is worth considering. Be aware that friction at login reduces conversion for customers who are not already familiar with 2FA. A middle path is to offer 2FA as an opt-in for customers with a visible prompt on My Account, rather than mandating it.
Complementary Security Measures for WooCommerce
2FA protects the login process. It does not protect against weak session management, plugin vulnerabilities, or unencrypted connections. Pair 2FA with HTTPS enforced sitewide, login rate limiting and lockout after failed attempts, and a web application firewall to block known bot patterns before they reach the login form.
Advanced Configuration Notes
A few configuration details that matter in practice:
Trusted Devices
WP 2FA Pro lets users mark a device as trusted for a configurable number of days. On a trusted device, the second factor is not required. This reduces friction for users who log in from the same computer daily. The trust is stored in a browser cookie, so it is lost if the user clears cookies or switches browsers.
XML-RPC and Application Passwords
2FA at the WordPress login form does not automatically protect XML-RPC or application password authentication. Both of these bypass the standard login flow. The most straightforward mitigation is to disable XML-RPC entirely if you do not need it, and to audit which application passwords are active. WP 2FA has settings to require 2FA for XML-RPC connections in its Pro version.
Custom Login Page Compatibility
If your site uses a custom login page via a plugin such as Theme My Login or a membership plugin, verify that WP 2FA works with it by testing after activation. Most major login-page plugins are compatible with WP 2FA, but behavior can vary, particularly for the post-login redirect after the 2FA prompt.
How 2FA Fits Into Your Broader WordPress Security Strategy
Two-factor authentication is one layer in a multi-layer security posture. It is particularly effective because it addresses a specific, well-defined attack vector: unauthorized login. It does not address vulnerabilities in plugin code, insecure file permissions, or server-level misconfigurations.
For a complete security baseline, 2FA should be accompanied by: keeping WordPress core, plugins, and themes fully updated; using strong, unique passwords managed by a password manager; running a security plugin that monitors file changes and blocks known attack patterns; taking regular off-site backups with tested restore procedures; and reviewing user accounts and removing accounts that no longer need access. The WordPress security audit checklist covers 20 areas to review monthly and gives you a structured framework to work through these layers systematically.
Frequently Asked Questions
Does 2FA slow down the login process?
Minimally. The added step is opening an authenticator app and typing a six-digit code, which takes roughly five seconds for a practiced user. Trusted device settings in WP 2FA Pro eliminate the step entirely on familiar devices.
Can I use SMS as a second factor?
WP 2FA Pro supports SMS OTP through Twilio integration. SMS-based 2FA is better than no 2FA, but it is the weakest 2FA method because SMS messages can be intercepted through SIM-swapping attacks. TOTP via Google Authenticator or Authy is significantly more secure and the practical best choice for most WordPress sites.
What happens if a user does not set up 2FA before the grace period ends?
In WP 2FA, after the grace period, the user is redirected to the mandatory 2FA setup screen every time they log in. They cannot access any part of the dashboard or front end until they complete setup. They are not locked out of their account entirely – they still need to go through the setup process.
Does 2FA protect REST API access?
REST API requests authenticated via cookie (browser sessions) benefit from 2FA because the session itself was established through a 2FA-protected login. REST API requests using application passwords or JWT tokens are separate authentication flows that bypass the login form. Secure those through application password auditing and token scope limitation.
Is there a free option that supports role-based enforcement?
Yes. WP 2FA’s free version includes role-based enforcement. This is one of the main reasons it is the recommended plugin for sites with multiple users who have different roles. The Two-Factor plugin does not include role enforcement in its free version.
Do I need 2FA if I already use a strong password and a login lockout plugin?
Yes. Login lockout prevents brute force attacks. A strong password prevents guessing. Neither protects against phishing (where you hand over your password to an attacker) or credential stuffing (where your password was already stolen from another site). 2FA is the layer that covers those scenarios.
Summary
Two-factor authentication is one of the highest-return security investments you can make on a WordPress site. The setup time is under 15 minutes for the entire site. The ongoing cost is a few seconds per login. The protection it provides against account takeover is substantial compared to password-only access.
Install WP 2FA, enable TOTP, enforce it for administrator and editor roles, and generate backup codes before you need them. That is the complete action plan. The FAQ and advanced sections above cover the edge cases as they come up.