Two-Factor

Beschrijving

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. There are no site-wide settings for this plugin.

For Individual Users

  1. Navigate to your profile: Go to “Users” “Your Profile” in the WordPress admin
  2. Find Two-Factor Options: Scroll down to the “Two-Factor Options” section
  3. Choose 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
    • E-mail codes – Receive one-time codes via email
    • FIDO U2F Security Keys – Use physical security keys (requires HTTPS)
    • Backup Codes – Generate one-time backup codes for emergencies
    • Dummy Method – For testing purposes only (requires WP_DEBUG)
  4. Configure each method: Follow the setup instructions for each enabled provider
  5. Set primary method: Choose which method to use as your default authentication
  6. Save changes: Click “Update Profile” to save your settings

For Site Administrators

  • No global settings: This plugin operates on a per-user basis only. For more, see GH#249.
  • 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

Available Authentication Methods

Authenticator App (TOTP) – Recommended

  • Security: High – Time-based one-time passwords
  • Setup: Scan QR code with authenticator app
  • 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

E-mail 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

  • Security: High – Hardware-based authentication
  • Setup: Register physical security keys (USB, NFC, or Bluetooth)
  • Requirements: HTTPS connection required, compatible browser needed
  • Browser Support: Chrome, Firefox, Edge (varies by key type)
  • Best for: Users with security keys who want maximum security

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

  • FIDO U2F Security Keys require an HTTPS connection to function
  • Other methods work on both HTTP and HTTPS sites

Browser Compatibility

  • FIDO U2F requires a compatible browser and may not work on all devices
  • 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.

Voor meer geschiedenis, zie dit bericht.

Acties & filters

Hier is een lijst van actie en filter hooks voorzien door de plugin:

  • two_factor_providers filter overschrijft de beschikbare twee-factor providers zoals e-mail en tijd-gebaseerde eenmalige wachtwoorden. Array waarden zijn PHP classnames van de twee-factor providers.
  • two_factor_providers_for_user filter overschrijft de beschikbare two-factor providers voor een specifieke gebruiker. Array waarden zijn instanties van provider klassen en het gebruikersobject WP_User is beschikbaar als het tweede argument.
  • two_factor_enabled_providers_for_user filter overschrijft de lijst van twee-factor providers die zijn ingeschakeld voor een gebruiker. Het eerste argument is een array van ingeschakelde provider classnames als waarden, het tweede argument is de gebruiker ID.
  • two_factor_user_authenticated actie die het ingelogde WP_User object ontvangt als eerste argument om de ingelogde gebruiker te bepalen direct na de authenticatie workflow.
  • two_factor_user_api_login_enable filter beperkt authenticatie voor REST-API en XML-RPC tot alleen applicatiewachtwoorden. Geeft de gebruiker ID als tweede argument.
  • two_factor_email_token_ttl filter overschrijft het tijdsinterval in seconden dat een e-mail token wordt beschouwd na generatie. Accepteert de tijd in seconden als eerste argument en de ID van het WP_User object dat wordt geverifieerd.
  • twee_factor_email_token_length filter heft het standaard aantal van 8 tekens voor e-mailtokens op.
  • two_factor_backup_code_length filter overschrijft het standaard aantal van 8 tekens voor back-upcodes. Geeft de WP_User van de geassocieerde gebruiker als tweede argument.
  • two_factor_rest_api_can_edit_user filter bepaalt of de twee-factor instellingen van een gebruiker bewerkt kunnen worden via de REST-API. Het eerste argument is de huidige $can_edit boolean, het tweede argument is de gebruiker 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_inputaction 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).

Schermafbeeldingen

  • Two-factor options under User Profile – Shows the main configuration area where users can enable different authentication methods.
  • U2F Security Keys section under User Profile – Displays the security key management interface for registering and managing FIDO U2F devices.
  • 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.

FAQ

Welke PHP en WordPress versies ondersteunt de Two-Factor plugin?

Deze plugin ondersteunt de laatste twee hoofdversies van WordPress en de minimale PHP versie die door die WordPress versies wordt ondersteund.

Hoe verstuur ik feedback of krijg ik hulp bij een fout?

De beste plaats om bugs, suggesties voor functies of andere feedback te melden is op de Two Factor GitHub issues pagina. Voordat je een nieuw probleem indient, zoek dan eerst in de bestaande problemen om te controleren of iemand anders dezelfde feedback heeft gerapporteerd.

Waar kan ik beveiligingsproblemen melden?

De plugin bijdragers en WordPress gemeenschap nemen beveiligingsbugs serieus. Wij waarderen je inspanningen om je bevindingen op verantwoorde wijze bekend te maken, en zullen alles in het werk stellen om je bijdragen te erkennen.

Om een beveiligingsprobleem te melden, ga je naar de WordPress HackerOne programma.

Why doesn’t this plugin have site-wide settings?

This plugin is designed to work on a per-user basis, allowing each user to choose their preferred authentication methods. This approach provides maximum flexibility and security. Site administrators can still configure 2FA for other users by editing their profiles. For more information, see issue #437.

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 currently supports FIDO U2F, which is the predecessor to WebAuthn. For full WebAuthn support, you may want to look into additional plugins that extend this functionality. The current U2F implementation requires HTTPS and has browser compatibility limitations.

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: https://wordpress.org/plugins/two-factor-provider-webauthn/
. It integrates directly with Two-Factor and adds WebAuthn-based authentication as an additional two-factor option for users.

Beoordelingen

15 januari 2026
Install, activate. Go to your user profile and add your 2FA with your password manager/authentication app. Done. So easy and efficient. No bells and whistles, but if securing your admin account(s) is all that matters, it’s the best and easiest option. Thanks to the team for this!
20 augustus 2025 3 reacties
A great plugin and absolutely useful and important! Unfortunately, there is a problem that needs to be addressed and resolved: The QR code generated for 2FA apps is reported as incorrect by the 2FAS smartphone app. If you type the code below into the app, everything works fine. This problem did not occur with Google Authenticator. Of course, it seems to be a problem with the 2FAS app, because Google can do it! But shouldn’t the problem be analyzed in more detail on the developer side? I will probably also inform the developer of the app. However, it would certainly be best if the two experts (plugin here and app there) got in touch with each other.
17 juli 2025
This plugin made it really easy to add two-factor authentication to my WordPress test site. The interface is clean, and the setup took just a few minutes. Works well with email and TOTP apps like Google Authenticator. A must-have for basic security!
Lees alle 196 beoordelingen

Bijdragers & ontwikkelaars

“Two-Factor” is vertaald in 38 talen. Dank voor de vertalers voor hun bijdragen.

Vertaal “Two-Factor” naar jouw taal.

Interesse in de ontwikkeling?

Bekijk de code, haal de SVN repository op, of abonneer je op het ontwikkellog via RSS.

Changelog

0.15.0 – 2026-02-13

  • Breaking Changes: Trigger two-factor flow only when expected by @kasparsd in #660 and #793.
  • New Features: Include user IP address and contextual warning in two-factor code emails by @todeveni in #728
  • New Features: Optimize email text for TOTP by @masteradhoc in #789
  • New Features: Add “Settings” action link to plugin list for quick access to profile by @hardikRathi in #740
  • New Features: Additional form hooks by @eric-michel in #742
  • New Features: Full RFC6238 Compatibility by @ericmann in #656
  • New Features: Consistent user experience for TOTP setup by @kasparsd in #792
  • Documentation: @since docs by @masteradhoc in #781
  • Documentation: Update user and admin docs, prepare for more screenshots by @jeffpaul in #701
  • Documentation: Add changelog & credits, update release notes by @jeffpaul in #696
  • Documentation: Clear readme.txt by @masteradhoc in #785
  • Documentation: Add date and time information above TOTP setup instructions by @masteradhoc in #772
  • Documentation: Clarify TOTP setup instructions by @masteradhoc in #763
  • Documentation: Update RELEASING.md by @jeffpaul in #787
  • Development Updates: Pause deploys to SVN trunk for merges to master by @kasparsd in #738
  • Development Updates: Fix CI checks for PHP compatability by @kasparsd in #739
  • Development Updates: Fix Playground refs by @kasparsd in #744
  • Development Updates: Persist existing translations when introducing new helper text in emails by @kasparsd in #745
  • Development Updates: Fix missing_direct_file_access_protection by @masteradhoc in #760
  • Development Updates: Fix mismatched_plugin_name by @masteradhoc in #754
  • Development Updates: Introduce Props Bot workflow by @jeffpaul in #749
  • Development Updates: Plugin Check: Fix Missing $domain parameter by @masteradhoc in #753
  • Development Updates: Tests: Update to supported WP version 6.8 by @masteradhoc in #770
  • Development Updates: Fix PHP 8.5 deprecated message by @masteradhoc in #762
  • Development Updates: Exclude 7.2 and 7.3 checks against trunk by @masteradhoc in #769
  • Development Updates: Fix Plugin Check errors: MissingTranslatorsComment & MissingSingularPlaceholder by @masteradhoc in #758
  • Development Updates: Add PHP 8.5 tests for latest and trunk version of WP by @masteradhoc in #771
  • Development Updates: Add phpcs:ignore for falsepositives by @masteradhoc in #777
  • Development Updates: Fix(totp): otpauth link in QR code URL by @sjinks in #784
  • Development Updates: Update deploy.yml by @masteradhoc in #773
  • Development Updates: Update required WordPress Version by @masteradhoc in #765
  • Development Updates: Fix: ensure execution stops after redirects by @sjinks in #786
  • Development Updates: Fix WordPress.Security.EscapeOutput.OutputNotEscaped errors by @masteradhoc in #776
  • Dependency Updates: Bump qs and express by @dependabot[bot] in #746
  • Dependency Updates: Bump lodash from 4.17.21 to 4.17.23 by @dependabot[bot] in #750
  • Dependency Updates: Bump lodash-es from 4.17.21 to 4.17.23 by @dependabot[bot] in #748
  • Dependency Updates: Bump phpunit/phpunit from 8.5.44 to 8.5.52 by @dependabot[bot] in #755
  • Dependency Updates: Bump symfony/process from 5.4.47 to 5.4.51 by @dependabot[bot] in #756
  • Dependency Updates: Bump qs and body-parser by @dependabot[bot] in #782
  • Dependency Updates: Bump webpack from 5.101.3 to 5.105.0 by @dependabot[bot] in #780

0.14.2 – 2025-12-11

  • New Features: Add filter for rest_api_can_edit_user_and_update_two_factor_options by @gutobenn in #689
  • Development Updates: Remove Coveralls tooling and add inline coverage report by @kasparsd in #717
  • Development Updates: Update blueprint path to pull from main branch instead of a deleted f… by @georgestephanis in #719
  • Development Updates: Fix blueprint and wporg asset deploys by @kasparsd in #734
  • Development Updates: Upload release only on tag releases by @kasparsd in #735
  • Development Updates: Bump playwright and @playwright/test by @dependabot[bot] in #721
  • Development Updates: Bump tar-fs from 3.1.0 to 3.1.1 by @dependabot[bot] in #720
  • Development Updates: Bump node-forge from 1.3.1 to 1.3.2 by @dependabot[bot] in #724
  • Development Updates: Bump js-yaml by @dependabot[bot] in #725
  • Development Updates: Mark as tested with the latest WP core version by @kasparsd in #730

0.14.1 – 2025-09-05

  • Don’t URI encode the TOTP url for display. by @dd32 in #711
  • Removed the duplicate Security.md by @slvignesh05 in #712
  • Fixed linting issues by @sudar in #707
  • Update development dependencies and fix failing QR unit test by @kasparsd in #714
  • Trigger checkbox js change event by @gedeminas in #688

0.14.0 – 2025-07-03

  • Features: Enable Application Passwords for REST API and XML-RPC authentication (by default) by @joostdekeijzer in #697 and #698. Previously this required two_factor_user_api_login_enable filter to be set to true which is now the default during application password auth. XML-RPC login is still disabled for regular user passwords.
  • Features: Label recommended methods to simplify the configuration by @kasparsd in #676 and #675
  • Documentation: Add WP.org plugin demo by @kasparsd in #667
  • Documentation: Document supported versions of WP core and PHP by @jeffpaul in #695
  • Documentation: Document the release process by @jeffpaul in #684
  • Tooling: Remove duplicate WP.org screenshots and graphics from SVN trunk by @jeffpaul in #683

0.13.0 – 2025-04-02

  • Add two_factor_providers_for_user filter to limit two-factor providers available to each user by @kasparsd in #669
  • Update automated testing to cover PHP 8.4 and default to PHP 8.3 by @BrookeDot in #665

View the complete changelog details here.