How to Add 2FA to a Custom Login Form
The plugin adds its step to WordPress’s own password check, which every proper login form goes through. Most custom forms need nothing.
Forms that reload the page
Section titled “Forms that reload the page”A form that posts to WordPress and reloads gets the code screen after a correct password, on the My Account page for WooCommerce forms and on wp-login.php for the rest.
Login popups that use Ajax
Section titled “Login popups that use Ajax”A popup cannot show a second screen, so it shows the message the plugin returns: “This account uses two-factor authentication. Continue to enter your code.” The link opens the code screen for that sign in.
Forms that post the code with the password
Section titled “Forms that post the code with the password”A one-step form can collect the code itself and send it in a field named _ddwcga_authentication_code,
together with the username and password.
<input type="text" name="_ddwcga_authentication_code" inputmode="numeric" autocomplete="one-time-code" />A right code signs in at once. A wrong one is refused with “The two-factor authentication code is wrong.” and counts towards the lockout. On the demo, both cases behaved this way. Trusted devices skip the field.
Developer hooks
Section titled “Developer hooks”ddwcga_activityfires after every two-factor event, with the event, user ID, method and where it happened.ddwcga_trust_proxy_headersreturnstruebehind a trusted proxy, so the log records the visitor’s address.ddwcga_display_myaccounts_menuhides the My Account menu item.ddwcga_modify_admin_menu_capabilitychanges who sees the admin screens,manage_woocommerceby default.ddwcga_configurationfilters every setting.

