plugin-icon

Two-Factor

投稿者: WordPress.org·
時間ベースのワンタイムパスワード (TOTP)、Universal 2nd Factor (U2F)、メール、バックアップ検証コードを使用して二要素認証 (2FA) を有効にします。
評価機能
4.8
バージョン
0.15.0
有効インストール数
100K
最終更新日時
Feb 17, 2026
Two-Factor

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
    • メールコード – 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

メールコード

  • 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.

詳細な経緯は、この記事を参照してください。

アクション & フィルター

プラグインで提供するアクションフックとフィルターフックは以下のとおり:

  • two_factor_providers フィルターフックは、メールや Time Based One-Time Password などの利用可能な2要素認証プロバイダーを上書きします。配列値は、二要素認証プロバイダーの PHP クラス名です。
  • two_factor_providers_for_user フィルターは、特定のユーザーが利用可能な二要素認証プロバイダーを上書きします。配列の値はプロバイダークラスのインスタンスで、2番目の引数にはユーザーオブジェクト WP_User を指定します。
  • two_factor_enabled_providers_for_user フィルターフックは、ユーザーに対して有効化している二要素認証プロバイダーの一覧を上書きします。最初の引数は、有効なプロバイダークラス名の配列であり、2番目の引数はユーザーIDです。
  • two_factor_user_authenticated アクションフックは、認証処理直後に、ログインしたユーザーを判別するための最初の引数として、ログインした WP_User オブジェクトを返します。
  • two_factor_user_api_login_enable フィルターは REST API と XML-RPC での認証をアプリケーションパスワードのみに制限します。2番目の引数にユーザー ID が提供されます。
  • two_factor_email_token_ttl フィルターフックは、メールトークン生成後の有効期間を秒単位で上書きします。第一引数として秒単位の時間を受け付け、また、認証する WP_User オブジェクトの ID も受け付けます。
  • two_factor_email_token_length フィルターは、メールトークンのデフォルト文字数8を上書きします。
  • two_factor_backup_code_length フィルターは、バックアップコードのデフォルトの文字数「8」を上書きします。関連付けられているユーザーの WP_User を2番目の引数として指定します。
  • two_factor_rest_api_can_edit_user フィルターは、REST API を介してユーザーの2要素認証の設定を編集できるかどうかを上書きします。1番目の引数は現在の $can_edit (真偽値)、2番目の引数はユーザー 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).
無料有料プラン
インストールすることで、WordPress.com の利用規約サードパーティプラグイン利用規約に同意したことになります。
最大テスト回数
WordPress 6.9.4
このプラグインをダウンロードして、 サイトに使用できます。