The Two-Factor plugin adds an extra layer of security to your WordPress login by requiring users to provide a second form of authentication in addition to their password. This helps protect against unauthorized access even if passwords are compromised. Setup Instructions Important : Each user must i
PricingFree downloadThe WordPress.org download is free. Pro versions, add-ons or external services may cost extra.
CompatibilityRequires WordPress 7.0 and PHP 7.4.
SourceWordPress plugins · Nov 2, 2026
01 / Source details
Aboutthistool.
The Two-Factor plugin adds an extra layer of security to your WordPress login by requiring users to provide a second form of authentication in addition to their password. This helps protect against unauthorized access even if passwords are compromised.
Setup Instructions
Important : Each user must individually configure their two-factor authentication settings.
For Individual Users
01Navigate to your profile : Go to “Users” → “Your Profile” in the WordPress admin
02Find Two-Factor Options : Scroll down to the “Two-Factor Options” section
03Choose your methods : Enable one or more authentication providers (noting a site admin may have hidden one or more so what is available could vary): Authenticator App (TOTP) – Use apps like Google Authenticator, Authy, or 1Password
04Email Codes – Receive one-time codes via email
05Backup Codes – Generate one-time backup codes for emergencies
06Dummy Method – For testing purposes only (requires WP_DEBUG)
07Configure each method : Follow the setup instructions for each enabled provider
08Set primary method : Choose which method to use as your default authentication
09Save changes : Click “Update Profile” to save your settings
For Site Administrators
Plugin settings : The plugin provides a settings page under “Settings → Two-Factor” to configure which providers should be disabled site-wide.
User management : Administrators can configure 2FA for other users by editing their profiles
Security recommendations : Encourage users to enable backup methods to prevent account lockouts
Compatibility : Works with Google Authenticator, Authy, 1Password, and other TOTP apps
Best for : Most users, provides excellent security with good usability
Backup Codes – Recommended
Security : Medium – One-time use codes
Setup : Generate 10 backup codes for emergency access
Compatibility : Works everywhere, no special hardware needed
Best for : Emergency access when other methods are unavailable
Email Codes
Security : Medium – One-time codes sent via email
Setup : Automatic – uses your WordPress email address
Compatibility : Works with any email-capable device
Best for : Users who prefer email-based authentication
FIDO U2F Security Keys
Deprecated and removed due to loss of browser support.
Dummy Method
Security : None – Always succeeds
Setup : Only available when WP_DEBUG is enabled
Purpose : Testing and development only
Best for : Developers testing the plugin
Important Notes
HTTPS Requirement
All methods work on both HTTP and HTTPS sites
Browser Compatibility
TOTP and email methods work on all devices and browsers
Account Recovery
Always enable backup codes to prevent being locked out of your account
If you lose access to all authentication methods, contact your site administrator
Security Best Practices
Use multiple authentication methods when possible
Keep backup codes in a secure location
Regularly review and update your authentication settings
For more information about two-factor authentication in WordPress, see the WordPress Advanced Administration Security Guide .
For more history, see this post .
Actions & Filters
Here is a list of action and filter hooks provided by the plugin:
two_factor_providers filter overrides the available two-factor providers such as email and time-based one-time passwords. Array values are PHP classnames of the two-factor providers.
two_factor_providers_for_user filter overrides the available two-factor providers for a specific user. Array values are instances of provider classes and the user object WP_User is available as the second argument.
two_factor_enabled_providers_for_user filter overrides the list of two-factor providers enabled for a user. First argument is an array of enabled provider classnames as values, the second argument is the user ID.
two_factor_is_required_for_user filter controls whether two-factor authentication is required for a user. Return false to bypass the two-factor flow (e.g. for trusted IP addresses). First argument is a boolean (whether the user has a primary provider configured), the second argument is the WP_User object.
two_factor_fallback_provider_for_user filter overrides the provider forced on when none of a user’s stored two-factor providers are still registered (e.g. after a provider plugin is deactivated). Defaults to Two_Factor_Email . First argument is the provider classname, the second is the user ID, the third is the array of provider classnames that were stored for the user but are no longer registered. The returned provider must be registered and available to the user ( is_available_for_user() ), or the user is shown an error instead of being let through with a fallback.
two_factor_user_authenticated action which receives the logged in WP_User object as the first argument for determining the logged in user right after the authentication workflow.
two_factor_user_api_login_enable filter restricts authentication for REST API and XML-RPC to application passwords only. Provides the user ID as the second argument.
two_factor_email_token_ttl filter overrides the time interval in seconds that an email token is considered after generation. Accepts the time in seconds as the first argument and the ID of the WP_User object being authenticated.
two_factor_email_token_length filter overrides the default 8 character count for email tokens.
two_factor_backup_code_length filter overrides the default 8 character count for backup codes. Provides the WP_User of the associated user as the second argument.
two_factor_rest_api_can_edit_user filter overrides whether a user’s Two-Factor settings can be edited via the REST API. First argument is the current $can_edit boolean, the second argument is the user ID.
two_factor_before_authentication_prompt action which receives the provider object and fires prior to the prompt shown on the authentication input form.
two_factor_after_authentication_prompt action which receives the provider object and fires after the prompt shown on the authentication input form.
two_factor_after_authentication_input action which receives the provider object and fires after the input shown on the authentication input form (if form contains no input, action fires immediately after two_factor_after_authentication_prompt ).
two_factor_login_backup_links filters the backup links displayed on the two-factor login form.
two_factor_login_nonce_failed action which fires when a login nonce fails verification. Provides the ID of the user the nonce was presented for as the first argument, and the reason as the second: no_nonce_stored , expired , or mismatch .
two_factor_log_login_nonce_failures filter overrides whether a failed login nonce verification is written to the PHP error log. Defaults to true for expired and mismatch , and false for no_nonce_stored , which any unauthenticated request can reach. Provides the user ID as the second argument and the reason as the third.
WP-CLI Commands
The plugin includes a wp two-factor WP-CLI namespace for managing two-factor authentication from the command line. All commands accept a user by ID, login, or email.
wp two-factor status <user> — Shows a user’s current 2FA status (read-only). Supports --format=json .
wp two-factor list-providers — Lists all registered two-factor providers.
wp two-factor enable <user> <provider> — Enables a provider for a user. Providers that require a shared secret (like TOTP) can’t be enabled this way and will point you to the profile page instead.
wp two-factor disable <user> [<provider>] — Disables a single provider, or performs a full reset of all 2FA for the user when no provider is given. Both forms prompt for confirmation unless --yes is passed.
wp two-factor backup-codes generate <user> [--count=<n>] — Generates a fresh set of backup codes for a user, replacing any existing ones. Defaults to 10 codes.
wp two-factor unlock <user> — Clears a user’s login rate-limit/throttle without changing their 2FA configuration.
Run wp help two-factor for the full list, or wp help two-factor <command> for options and examples for a specific command.
Redirect After the Two-Factor Challenge
To redirect users to a specific URL after completing the two-factor challenge, use WordPress Core built-in login_redirect filter. The filter works the same way as in a standard WordPress login flow:
Two-factor options under User Profile - Shows the main configuration area where users can enable different authentication methods.Email Code Authentication during WordPress Login - Shows the email verification screen that appears during login.Authenticator App (TOTP) setup with QR code - Demonstrates the QR code generation and manual key entry for TOTP setup.Backup codes generation and management - Shows the backup codes interface for generating and managing emergency access codes.
02 / Source details
Frequently asked questions.
What PHP and WordPress versions does the Two-Factor plugin support?
This plugin supports the last two major versions of WordPress and the minimum PHP version supported by those WordPress versions.
How can I send feedback or get help with a bug?
The best place to report bugs, feature suggestions, or any other (non-security) feedback is at the Two Factor GitHub issues page . Before submitting a new issue, please search the existing issues to check if someone else has reported the same feedback.
Where can I report security bugs?
The plugin contributors and WordPress community take security bugs seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
To report a security issue, please visit the WordPress HackerOne program.
What if I lose access to all my authentication methods?
If you have backup codes enabled, you can use one of those to regain access. If you don’t have backup codes or have used them all, you’ll need to contact your site administrator to reset your account. This is why it’s important to always enable backup codes and keep them in a secure location.
Can I use this plugin with WebAuthn?
The plugin previously supported FIDO U2F, which was a predecessor to WebAuthn. There is an open issue to add WebAuthn support here .
Is there a recommended way to use passkeys or hardware security keys with Two-Factor?
Yes. For passkeys and hardware security keys, you can install the Two-Factor Provider: WebAuthn plugin . It integrates directly with Two-Factor and adds WebAuthn-based authentication as an additional two-factor option for users.
Does this plugin work on WordPress Multisite?
Yes. The Two-Factor plugin is compatible with WordPress Multisite. Each user configures their own 2FA settings via their profile, and because authentication codes are stored in WordPress user meta, the configuration is tied to the user account and valid across all sites in the network. However, there are no network-wide settings — a super admin cannot enforce or configure 2FA globally from the Network Admin dashboard. To manage 2FA for a specific user, edit their profile on any site where they have an account.
How do I disable 2FA for a user who is locked out?
As an administrator, go to Users → All Users in the WordPress admin, click Edit on the affected user’s profile, scroll down to the Two-Factor Options section, and uncheck all enabled methods, then click Update User . This will remove 2FA for that user, allowing them to log in with their password alone. You can also do this via WP-CLI with wp two-factor disable –yes, which performs a full reset (see the WP-CLI Commands section above). Once they’re back in, encourage them to re-enable 2FA and generate fresh backup codes.
Can I require 2FA for all users or specific roles?
Not through the plugin’s interface — there are no built-in enforcement settings. However, developers can use the two_factor_providers_for_user filter to control which providers are available per user or role, and combine it with custom logic to redirect users who haven’t set up 2FA. Native enforcement support is a known and tracked feature request — follow the discussion at GitHub issue #255 .
Website LLMs.txt and LLMs-Full.txt Generator is an LLMs.txt generator and llms-full.txt generator for WordPress. It helps site owners generate, manage, preview, validate, and serve AI discovery files from published public content. Use it to create structured /llms.txt and optional /llms-full.txt end
EngageDock AI is a customizable floating contact widget for WordPress websites that want more leads and faster visitor communication. It helps small businesses turn website traffic into calls, texts, emails, and callback requests from one clean contact panel. Key Features: Click-to-Call – One tap ca
Altify AI is an auto ALT text and AI ALT text plugin for WordPress images. It helps generate descriptive image ALT text for accessibility and image SEO. Use bulk image ALT text tools for your Media Library, generate featured image ALT text automatically, and scale WooCommerce image ALT updates with
The Accepted Payment Methods plugin is a straightforward, lightweight solution that enhances your website by displaying visually appealing icons of the payment methods you accept. This plugin is ideal for a variety of websites, including e-commerce platforms, service-oriented websites, and informati