You inherit a WordPress install with 47 editors and shop managers, password-only authentication, and a board mandate to enforce 2FA before the quarter closes. The previous attempt was a flag flipped on a Friday afternoon; the marketing director was locked out for two days and the rollout was rolled back. The board mandate did not disappear — only the willingness to attempt it again. A 2FA rollout is not a plugin install. It is a sequenced runbook that treats the human side — the editor who travels with one phone, the freelancer who shares an account with their assistant — as the harder problem.
What’s happening
WordPress core has no built-in second factor. Every 2FA deployment is a plugin choice (Wordfence, miniOrange, Two-Factor by the WP feature plugin team, Solid Security, WP 2FA) and a policy choice. The plugin choice is mostly equivalent at the protocol level — TOTP via RFC 6238, optional WebAuthn, optional email or SMS fallback. The policy choice is where rollouts fail.
The three policy decisions that determine whether a rollout sticks:
- Enforcement scope. Which roles must enroll, by when, and what happens when the deadline passes — soft block (banner), hard block (login refused), or graceful (allow login but force enrollment before next action).
- Recovery flow. Lost-device path that doesn’t require an engineer at 2 a.m. Recovery codes generated at enrollment, stored by the user; recovery process owned by the site admin team, not the platform vendor.
- Exception process. The shared editorial account, the seasonal vendor, the agency contractor — each one needs either a real per-human account with 2FA, or a documented short-lived exception with an expiry date.
The technical layer takes a day. The policy + comms + helpdesk staffing takes three weeks. Skip the second and you get the Friday-afternoon rollback.
How to verify
Take inventory before you enable anything. The relevant questions are: who has an account, who actually logs in, who would be locked out by a hard enforcement today.
# All users grouped by role
wp user list --fields=ID,user_login,user_email,roles,user_registered \
--format=csv > /tmp/wp-users-inventory.csv
# Anyone who logged in within the last 90 days
wp user list --meta_key=last_login --format=table \
--fields=ID,user_login,roles,last_login
# Editors + administrators + shop managers — your enforcement scope
wp user list --role=administrator,editor,shop_manager \
--fields=ID,user_login,user_email,roles --format=csv
If you don’t have a last_login meta because the site never tracked it, install the Simple History plugin or read the access log for the last 90 days — anything else is guessing. For multisite, run the same audit per blog ID; super-admins live in wp_sitemeta and need separate handling.
Verify 2FA status once your plugin is installed. Wordfence stores it in wf2fasecrets; Two-Factor uses _two_factor_enabled_providers usermeta:
wp user meta list <user-id> | grep -i 2fa
wp db query "SELECT user_id FROM wp_usermeta \
WHERE meta_key = '_two_factor_enabled_providers' \
AND meta_value LIKE '%Two_Factor_Totp%'"
The delta between users-with-2FA-enrolled and users-in-the-enforcement-scope is your remaining work.
The fix
A four-week rollout, run as a runbook with named owners. The dates are aggressive but reasonable for a 50-person editorial team.
Week 0 — preparation.
Pick the plugin. For most WP installs, the Two-Factor feature plugin (built by the WP core 2FA team) is the right default: TOTP, backup codes, email fallback, FIDO2 via a companion. It does not phone home, has no upsell, and integrates with WP-CLI.
Install on a staging site that mirrors production. Configure providers:
wp plugin install two-factor --activate
wp option update two_factor_enabled_providers \
'["Two_Factor_Totp","Two_Factor_Backup_Codes","Two_Factor_Email"]' \
--format=json
Decide enforcement scope (administrator + editor + shop_manager is the standard starting point; author and contributor follow in phase 2). Decide deadlines. Write the comms in plain language — what the user will see, what they need to do, who to email if they get stuck.
Week 1 — voluntary enrollment + comms.
Send the announcement. Enable the plugin in production with no enforcement yet. Every user sees the enrollment screen but can dismiss it. Track enrollment daily:
wp db query "SELECT COUNT(*) FROM wp_usermeta \
WHERE meta_key = '_two_factor_enabled_providers' \
AND meta_value LIKE '%Two_Factor_Totp%'"
You want 30-40% enrollment voluntarily before any enforcement. If you don’t, the policy comms didn’t land — fix the comms before you turn enforcement on.
Week 2 — soft enforcement.
Show a persistent banner (“you must enroll by [date]”) on every login for users in scope. No login refusal yet. Run a help session — a 30-minute drop-in for editors to enroll with someone walking them through it. Most lockouts come from “I never enrolled because I never got around to it”; the drop-in eliminates that excuse.
Week 3 — hard enforcement for admins + editors.
Force enrollment on next login for the privileged roles. The Two-Factor plugin supports this via a custom enforcer:
// mu-plugins/2fa-enforcement.php
add_action('admin_init', function () {
$user = wp_get_current_user();
if (!$user || !$user->ID) return;
$enforced_roles = ['administrator', 'editor', 'shop_manager'];
if (!array_intersect($enforced_roles, (array) $user->roles)) return;
$providers = get_user_meta($user->ID, '_two_factor_enabled_providers', true);
if (!empty($providers)) return;
if (basename($_SERVER['PHP_SELF']) === 'profile.php') return;
wp_safe_redirect(admin_url('profile.php#two-factor-options'));
exit;
});
Hard enforcement means: until the user enrolls, the only admin page that loads is profile.php. Login itself isn’t blocked — they can authenticate — but they can’t reach the editor or commerce screens until 2FA is configured. This avoids the “locked out” scenario while preserving enforcement.
Recovery codes policy.
At enrollment, the plugin generates ten single-use backup codes. Two non-negotiable rules:
- The user stores their own codes. A password manager entry, a printed slip in a locked drawer — anywhere except the same device that holds the TOTP secret. If the codes live on the same phone that runs Authy, the recovery story is “phone is stolen, account is gone.”
- The site admin team holds the recovery process, not the recovery codes. When a user loses both phone and codes, they email a designated admin from the address on file. The admin verifies identity via a second channel (Slack DM, video call — something that proves the requester is the human, not someone who compromised the email). Only then does the admin issue a one-time recovery link:
wp user reset-password <user_login> --skip-email
wp eval 'delete_user_meta(get_user_by("login","<user_login>")->ID, "_two_factor_enabled_providers");'
# Generate a one-time login link and send via the second channel
wp user generate-login-url <user_login> # requires a CLI extension
The admin emails the user a temporary password through the verified channel, the user logs in, re-enrolls 2FA immediately, and the incident is logged.
Exception process.
Some accounts genuinely cannot run 2FA today — a vendor service account that runs nightly imports, a contractor whose contract ends in two weeks. The exception process:
- Exception requested in writing (ticket, email — something durable).
- Exception scoped: which user, which roles, what’s the alternative compensating control (IP allowlist, application password with limited capabilities, single-use account that gets deleted at contract end).
- Exception has an expiry. Maximum 30 days. Renewals require a new request — no automatic rollover.
- Exception logged in a place the security review will see at the next quarterly audit.
The technical implementation of an exception is a usermeta flag the enforcement mu-plugin honors:
$exempt = get_user_meta($user->ID, '_2fa_exemption_until', true);
if ($exempt && strtotime($exempt) > time()) return;
When the exception expires, enforcement re-engages automatically. No human in the loop, no exception that quietly becomes permanent.
Week 4 — extend to author + contributor + audit.
Run the same enforcement playbook for the lower-privilege roles. By now, the helpdesk has answered the same five questions twenty times and the playbook is calibrated.
Audit at the end:
# Anyone in scope without 2FA
wp db query "
SELECT u.user_login, u.user_email, GROUP_CONCAT(um2.meta_value) as roles
FROM wp_users u
JOIN wp_usermeta um2 ON u.ID = um2.user_id AND um2.meta_key = 'wp_capabilities'
LEFT JOIN wp_usermeta um ON u.ID = um.user_id
AND um.meta_key = '_two_factor_enabled_providers'
WHERE um.meta_value IS NULL
AND (
um2.meta_value LIKE '%administrator%' OR
um2.meta_value LIKE '%editor%' OR
um2.meta_value LIKE '%shop_manager%'
)
GROUP BY u.ID;"
Zero rows is the goal. Anything else is either an active exception (verify against the exception log) or a gap.
Stack Harbor runs this rollout playbook as part of enterprise WordPress hosting operations, including the helpdesk staffing for the rollout window and the recovery process owned by named admins. If the previous attempt rolled back and the board mandate hasn’t, let us scope the rerun.