外掛說明
簡單、輕量化、有實效,可透過電子郵件進行兩步驟驗證的外掛。網站管理員可以為個別使用者啟用這項功能,也可以在網站的 wp-config.php 檔案中增加一行常數,便能為全部網站管理員、編輯或全部帳號強制啟用這項功能。
WordPress 是目前最受歡迎的內容管理系統 (CMS),全球超過 40% 的網站都執行 WordPress。正因為如此,它成為駭客希望透過已揭露的未授權存取漏洞攻擊的主要目標。保護 WordPress 網站安全中最有效的方式,便是為網站管理員啟用兩步驟驗證功能。
- 啟用外掛後,便能為個別使用者啟用兩步驟驗證功能。
- 請確保 WordPress 網站能夠正常傳送電子郵件。最佳方式是使用 SMTP 外掛。
參考我們開發的其他外掛:
- 🦄 Unicorn Panel – the new web hosting control panel built for multi-server fleets; FREE!
- 🎉 Media Library File Size
- ✨ Export Single Post Page
- 🙍♂️ View User Metadata
- 🔠 Enable Turnstile (Cloudflare) for Gravity Forms
- ⭐️⭐️⭐️⭐️⭐️ Gravity Forms to FreeScout
螢幕擷圖
![在每一個使用者的 [個人資料] 頁面,使用者可以自行開啟或關閉兩步驟驗證功能](https://ps.w.org/two-factor-2fa-via-email/assets/screenshot-1.gif?rev=2895285)



安裝方式
使用 WordPress 的自動安裝程式或下載外掛安裝套件 ZIP 壓縮檔,並且依照以下方式安裝:
- 將外掛安裝套件 ZIP 壓縮檔解壓縮所得的
two-factor-2fa-via-email資料夾上傳至網站的/wp-content/plugins/目錄中。 - 在 WordPress 管理後台的 [外掛] 選單中啟用外掛。
- 使用者前往個人專屬的 [個人資料] 頁面 (網站管理員可前往個別使用者的 [個人資料] 頁面),然後啟用兩步驟驗證。
常見問題集
-
帳號遭到鎖定,需要協助!
-
如果使用者沒有收到可以獲得帳號登入存取權的電子郵件,網站管理員就必須停用這個外掛。此時停用外掛的唯一方式,便是將外掛資料夾從
two-factor-2fa-via-email重新命名為two-factor-2fa-via-email.backup或其他名稱。 -
15 分鐘的登入連結有效時間對使用者來說太長/太短。如何變更這項預設值?
-
可以。從 1.5.2 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_LINK_EXPIRES_MINUTES', 10);上方常數示範設定值的 10 代表登入連結有效時間,單位為分鐘,網站管理員可以依據需求變更。
-
是否能為每一位 [網站管理員] 使用者群組的使用者強制啟用外掛提供的兩步驟驗證功能?
-
可以。從 1.6 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_ENABLE_ADMINS', true); -
是否能為每一位 [編輯] 使用者群組的使用者強制啟用外掛提供的兩步驟驗證功能?
-
可以。從 1.6 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_ENABLE_EDITORS', true); -
是否能為每一位 [投稿者] 使用者群組的使用者強制啟用外掛提供的兩步驟驗證功能?
-
可以。從 1.9.2 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_ENABLE_CONTRIBUTORS', true); -
是否能為每一位 [訂閱者] 使用者群組的使用者強制啟用外掛提供的兩步驟驗證功能?
-
可以。從 1.7.1 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_ENABLE_SUBSCRIBERS', true); -
是否能為網站的全部使用者強制啟用外掛提供的兩步驟驗證功能?
-
可以。從 1.6 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_ENABLE_ALL', true); -
是否能變更外掛停用通知電子郵件的預設收件者?
-
可以。從 1.6 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_NOTIFICATION_EMAIL', 'john@doe.com');請將常數示範設定值的
john@doe.com依需求變更為需要的電子郵件地址。 -
是否能在使用 REST API 時停用兩步驟驗證?
-
可以。從 1.9 版開始,網站管理員可以在網站的
wp-config.php檔案中加入以下常數及設定值。define('SS88_2FAVE_API_DISABLE_ALL', true); -
如何在使用者登入後重新導向至指定網址?
-
從 1.9.1 版開始,網站管理員可以使用
SS88_2FAVE_custom_redirect篩選器,如下所示:add_filter('SS88_2FAVE_custom_redirect', function($URL) { if(current_user_can('editor')) return 'https://custom.com/page/here'; else return $URL; }); -
是否能覆寫 isEnabled 函式?
-
從 1.9.1 版開始,網站管理員可以使用
SS88_2FAVE_isEnabled篩選器,如下所示:add_filter('SS88_2FAVE_isEnabled', function($isEnabled, $UserID, $type) { // $isEnabled = Prior value // $UserID = ID of user // $type = Values are API or LOGIN return $isEnabled; }, 10, 3);請注意,如果網站管理員設定了
SS88_2FAVE_ENABLE_ALL、SS88_2FAVE_ENABLE_ADMINS、SS88_2FAVE_ENABLE_EDITORS、SS88_2FAVE_ENABLE_CONTRIBUTORS、SS88_2FAVE_ENABLE_SUBSCRIBERS或SS88_2FAVE_API_DISABLE_ALL,SS88_2FAVE_isEnabled篩選器便會失效。
使用者評論
參與者及開發者
變更記錄
1.9.11
- Fix: Login link tokens are now hex-encoded so firewalls/WAFs no longer mistakenly flag them as malicious and block the login link. Existing links remain valid until they expire.
- Fix: Miscellaneous Plugin Check fixes.
1.9.10
- Security hardening. Please update ASAP.
- New: XML-RPC logins are now blocked for accounts that have the “2FA for REST API” option enabled (matching the existing REST API behaviour). Accounts that have never set that option are unaffected.
- New: The standard
wp_loginaction now fires when a user completes 2FA via the email link, so integrations that rely on it (last-login trackers, login-alert emails, activity logs) work correctly. - Added child theme support for custom templates.
ss88-2fa/login-email.phpandss88-2fa/2fa-page.phpare now loaded from the child theme first, then the parent theme. Thanks @gstricklind! - Added filters
SS88_2FAVE_email_templateandSS88_2FAVE_page_templateso developers can load the templates from any location. - Fix: The custom email template could fail to load if more than one 2FA email was sent in the same request.
- Compatibility: Tested up to WordPress 7.1.
1.9.9
- Please update ASAP. Security Fix: CVE-2025-13587
- Removal of logo on 2FA Login Screen
1.9.8
- Thank you for 10,000+ active installations! 🙂
- Fix: REST API authentication
1.9.7
- PHP Warning fix on new user
1.9.6
- Integrated Initialization Vector
- Canged Cipher to AES-256-CBC
- Added ‘pretty formatting’ when token decrption fails
1.9.5
- UX improvement: Refresh 2FA Page with countdown when user is sucessfully logged in
1.9.4
- Improved
header_remove()function by only removingSet-Cookie
1.9.3
- A new constant has been integrated which can be added in wp-config.php to override individual user settings to force 2FA to be enabled for Contributors. Add
SS88_2FAVE_ENABLE_CONTRIBUTORSto yourwp-config.phpi.e.define('SS88_2FAVE_ENABLE_CONTRIBUTORS', true);.
1.9.2
- Added PHP’s
header_remove();function upon logging in. Seems to solve 502 ad 503 issues, especially with GoDaddy.
1.9.1
- A new filter
SS88_2FAVE_custom_redirectwas added. You can now override the final URL where users are redirect to after sucessfully logging in. See example in FAQs. - A new filter
SS88_2FAVE_isEnabledwas added. You can now override if 2FA is enabled. See example in FAQs.
1.9
- The REST API (by default) has 2FA enabled. There are now new settings to disable it on an individual user basis by using the user edit screen.
- A new constant
SS88_2FAVE_API_DISABLE_ALLwas added to completely disable the 2FA on the REST API.
1.8
- Added 1.7.1 to trunk in WP Plugin Directory for rollback compatibility
- We are now using $priority 1 on the wp_login hook
- Added theme/folder compatibility. As of v1.4 developers could add
ss88-2fa-page.phpto their theme directory. We now support an additional directoryss88-2fai.e.wp-content/themes/xxx/ss88-2fa/2fa-page.php. v1.4 functionality will be removed in a future release in favor for the new directoryss88-2fa. - Added support for advanced developers to use a custom 2FA email. You can now override the 2FA email by copying
assets/html/login-email.phpto your theme’s directory. Upload this file towp-content/themes/xxx/ss88-2fa/login-email.phpto customize it!
1.7.1
- A new constant has been integrated which can be added in wp-config.php to override individual user settings to force 2FA to be enabled for Subscribers. Add
SS88_2FAVE_ENABLE_SUBSCRIBERSto yourwp-config.phpi.e.define('SS88_2FAVE_ENABLE_SUBSCRIBERS', true);.
1.7
- Localization integration
1.6.4
- Integration with the default Remember Me checkbox from WordPress
1.6.3
- Integration with Ultimate Member
1.6.2
- Removed accidental code forcing everyone who logged in to receive a 2FA screen
1.6.1
- Deactivation fatal error fix
1.6
- New Features:
- Wording changed when SMTP is not enabled.
- The plugin now sends an email to the site admin if the plugin is deactivated. The email can be overridden by defining the constant
SS88_2FAVE_NOTIFICATION_EMAILinwp-config.phpi.e.define('SS88_2FAVE_NOTIFICATION_EMAIL', 'john@doe.com'); - Three new constants added which can be added in wp-config.php to override individual user settings to force 2FA to be enabled. They are:
SS88_2FAVE_ENABLE_ALL(to enable for every single account),SS88_2FAVE_ENABLE_ADMINS(to enable only for Administrators), andSS88_2FAVE_ENABLE_EDITORS(to enable for Editors) i.e.define('SS88_2FAVE_ENABLE_ALL', true);.
1.5.2
- Replaced sanitize_url in favor of esc_url
- Added a new constant
SS88_2FAVE_LINK_EXPIRES_MINUTESso that users can define their own link expiry time in minutes - Added a JavaScript countdown timer to the login page
1.5.1
- Email content fix
1.5
- ‘Fancy’ emails
- Moving files into appropriate folders
- Re-order of security features when logging in
1.4
- Added PHP_INT_MAX to wp_login hook
- Added support for advanced developers to use a custom 2FA template. You can now override the 2FA page by copying
assets/2fa-page.phpto your theme’s directory. Upload this file towp-content/themes/xxx/ss88-2fa-page.phpto customize it!
1.3
- Fixed ‘dismiss’ link on notification
- Added support for SMTP Mailer check
1.2
- Added support link to plugin page
1.1
- Fix openssl key
- Fix echo’ing
1.0
- Initial release.
