WordPress 2FA Recovery: How to Use Backup Codes and Recover Access
Lost your phone or authenticator app? Learn how to recover WordPress access using backup codes and what to do if you're locked out of your 2FA-protected account.
When 2FA Becomes a Problem
Two-factor authentication is excellent security—until you lose access to your second factor. A lost phone, broken device, or accidentally deleted authenticator app can lock you out of your own WordPress site. This guide explains how to prepare for 2FA emergencies and recover access when things go wrong.
Prevention: Setting Up for Success
Save Your Backup Codes
When you enable 2FA with WP Folder Shield, you receive 10 one-time backup codes. These are your emergency access keys:
- Each code works only once
- They never expire (until used)
- They're generated specifically for your account
Where to Store Backup Codes
- Password Manager - In a secure note alongside your WordPress credentials
- Printed Copy - In a safe, safety deposit box, or secure location
- Encrypted File - On a backup drive with strong encryption
- Multiple Locations - Don't rely on just one storage method
Use Authy for Cloud Backup
Unlike Google Authenticator, Authy backs up your 2FA tokens to the cloud (encrypted). If you lose your phone, you can restore on a new device.
Set Up on Multiple Devices
Some authenticator apps (Authy, Microsoft Authenticator) sync across devices. Set up on both your phone and tablet for redundancy.
Recovery Method 1: Using Backup Codes
When to Use
- Lost phone
- Broken phone
- Deleted authenticator app
- Can't find device
How to Use a Backup Code
- Go to your WordPress login page
- Enter your username and password
- When prompted for 2FA code, look for "Use backup code" link
- Enter one of your saved backup codes
- You'll be logged in
After Using a Backup Code
- Go to Users > Profile
- Generate new backup codes
- Set up 2FA on your new device
- Save the new backup codes securely
Recovery Method 2: FTP/Database Access
If you've lost backup codes and phone, you can disable 2FA through file or database access.
Option A: Disable WP Folder Shield Temporarily
- Connect to your site via FTP/SFTP
- Navigate to wp-content/plugins/
- Rename "wp-folder-shield" to "wp-folder-shield-disabled"
- Log into WordPress (2FA is now disabled)
- Rename the folder back
- Reconfigure your 2FA
Option B: Remove 2FA via Database
- Access phpMyAdmin or database tool
- Find the wp_usermeta table
- Search for your user_id
- Delete rows with meta_key containing "2fa" or "totp"
- Log into WordPress
- Set up 2FA again
Warning: Database modifications can break your site. Always backup first.
Recovery Method 3: Contact Your Team
If you're not the only administrator:
- Contact another admin
- Have them go to Users > Your Profile
- They can generate new backup codes for you
- Or temporarily disable your 2FA requirement
Recovery Method 4: WP-CLI Access
If you have server/SSH access:
wp user meta delete USERNAME wpfs_totp_secret wp user meta delete USERNAME wpfs_2fa_enabled
This removes 2FA for that user, allowing normal login.
Best Practices After Recovery
Immediate Steps
- Set up 2FA on your new/recovered device
- Generate new backup codes
- Store backup codes in multiple secure locations
- Mark used backup codes as consumed
Review Your Security
- Check for any unauthorized access during lockout
- Review recent login history
- Verify no new admin users were created
- Check plugins list for unknown additions
WP Folder Shield Backup Code Management
Viewing Remaining Codes
In Users > Profile, you can see how many backup codes remain unused.
Generating New Codes
Click "Generate New Backup Codes" to create a fresh set. This invalidates all previous codes.
Admin Management
Super admins can manage 2FA for other users, including generating new backup codes or disabling 2FA temporarily.
Preventing Future Lockouts
Checklist
- ☐ Backup codes saved in password manager
- ☐ Backup codes printed and stored securely
- ☐ Using Authy or similar with cloud backup
- ☐ 2FA set up on secondary device
- ☐ Other admin has access (for team sites)
- ☐ Know how to access via FTP if needed
Conclusion
2FA lockouts are frustrating but preventable. The key is preparation: save your backup codes in multiple locations, use an authenticator app with cloud backup, and ensure you have recovery options before you need them. With proper preparation, you can maintain strong 2FA security while always having a path back in if something goes wrong.
Written by David Kim
WP Folder Shield Team