Troubleshooting
Wordfence 2FA Not Working: Causes and How to Fix It

Short answer
Wordfence 2FA usually fails because the phone or server clock is out of sync, the wrong authenticator entry is used, or a cached login page breaks the code prompt. Sync your phone time, use a recovery code if needed, and exclude the login page from caching.
Key takeaways
- Time-based codes fail when phone or server clocks drift.
- Each site and user has its own authenticator entry.
- Recovery codes let you in once each if you lose your phone.
- Another admin can deactivate 2FA for your account.
- Renaming the plugin folder via FTP is the last-resort fix.
- Cached login pages can hide the 2FA prompt.
Why is Wordfence 2FA not working?
Wordfence two-factor login usually fails because the clock on your phone or server is out of sync, the authenticator entry was set up for a different site, or a cache or plugin is interfering with the login form.
Wordfence includes free two-factor authentication through its Login Security module. After setup, you enter a six-digit code from an authenticator app each time you log in.
When it breaks, you might see invalid code messages, a login form that reloads without asking for a code, or no way to get back in after losing your phone.
This guide covers each cause in order, plus how to recover if you are locked out. If you have not set it up yet, see our guide on how to add two-factor authentication to WordPress.
What are the common problems and fixes at a glance?
Most Wordfence 2FA problems fall into a few patterns, and each has a quick first step.
| Problem | Likely cause | First fix |
|---|---|---|
| Codes always rejected | Phone or server clock wrong | Sync phone time, ask host to check server time |
| Codes rejected for one site only | Wrong entry in the authenticator app | Use the entry that matches the site |
| Lost phone | No access to the app | Use a recovery code |
| No code prompt shown | Cached login page or form conflict | Exclude login page from cache |
| App or WooCommerce login fails | Integration settings | Review Login Security options |
| No recovery codes left | Codes used up or lost | Ask another admin or disable via FTP |
Start with the row that matches your symptom, then read the full section below.
Is the time on your phone or server wrong?
Authenticator codes are based on the current time, so if your phone or your web server clock drifts by more than a short window, every code Wordfence checks will be rejected.
The codes follow the time-based one-time password standard. Your app and the server both calculate the code from a shared secret and the current time. If the two clocks disagree, the codes do not match.
On your phone, turn on automatic date and time in the system settings. In Google Authenticator on Android there has also been an option to sync time for codes.
The server clock is harder to check. Wordfence's two-factor authentication help page discusses time issues and how the plugin handles them.
If your phone time is correct and codes still fail on every account, ask your host to confirm the server time is synced with a time service. This is a quick check for them.
Are you using the right entry in your authenticator app?
If you have several sites in your app, you may be entering the code for a different site or an old entry left over from a previous setup.
Each WordPress site and user has its own secret. A code from another site, or from an earlier setup you later reset, will never work.
Look at the label for each entry. Wordfence usually names it with the site and username, but old entries can look similar.
If you reset 2FA at any point, delete the old entry from your app. Keeping only one entry per site avoids confusion.
Apps such as Google Authenticator, Microsoft Authenticator and others all work with Wordfence. Any app that supports standard time-based codes is fine.
How do you log in with a recovery code?
When you cannot use your authenticator app, type one of the recovery codes Wordfence gave you during setup into the code field instead of a six-digit app code.
Wordfence shows a set of recovery codes when you activate 2FA. Each code can be used once.
Enter your username and password as usual. When asked for the two-factor code, enter a recovery code exactly as shown, including any spacing format the plugin accepts.
Once logged in, go to the Wordfence Login Security screen. Deactivate 2FA for your account, then set it up again with your new device. Download the new recovery codes and store them safely, such as in a password manager.
If you never saved the codes, move to the sections on asking another admin or using FTP.
Can another administrator reset your 2FA?
Yes, an administrator who can still log in can deactivate two-factor authentication for your user account from the Wordfence Login Security area, letting you log in with just your password.
This is the cleanest recovery on sites with more than one admin. Ask a colleague or your developer to:
- Log in to WordPress.
- Open Wordfence, then Login Security, or the user management screen where Wordfence shows 2FA status.
- Find your account and deactivate 2FA for it.
You can then log in and set up 2FA again with your new phone.
Wordfence also has a legacy two-factor help page for sites still using the older system. Check which one your site runs before following instructions.
How do you disable Wordfence 2FA with FTP if you are locked out?
If you are the only admin and have no recovery codes, renaming the Wordfence plugin folder through FTP or your host's file manager deactivates the plugin, including its 2FA, so you can log in.
Steps:
- Connect to your site with FTP, SFTP or your host's file manager.
- Go to wp-content, then plugins.
- Rename the wordfence folder, for example to wordfence-off.
- Log in to WordPress with your username and password.
- Rename the folder back to wordfence.
- Reactivate the plugin under Plugins if needed, then reset 2FA for your account.
If you use the separate Wordfence Login Security plugin, rename that folder instead.
Do not leave the folder renamed. Your firewall and scanning are off while Wordfence is deactivated.
Our guide on how to get FTP access to WordPress covers connecting.
For other lockout causes, see fixing being locked out of wp-admin.
Is a cache or plugin breaking the 2FA prompt?
If the login page reloads without asking for a code, a caching plugin, CDN or another login plugin may be serving an old copy of the form or blocking the extra step.
Wordfence adds the 2FA step using JavaScript and AJAX on the login page. If the page is cached, those scripts can fail.
Check these points:
- Exclude wp-login.php and any custom login URL from page caching and CDN caching.
- Disable script delay or combine features for the login page in optimisation plugins.
- Temporarily deactivate other security or login plugins to test for a conflict.
- Clear your browser cache or try a private window.
Plugins that change the login URL can also confuse things. Our article on whether you should change the WordPress login URL covers the trade-offs.
The Health Check and Troubleshooting plugin lets you test with other plugins disabled for your session only.
Why does 2FA fail on WooCommerce or custom login forms?
Wordfence 2FA works on the standard WordPress login page, and support for WooCommerce and other custom forms depends on integration options in Login Security settings.
Look in the Login Security settings for options covering WooCommerce login and registration forms. Turn them on if your customers or staff log in through the My Account page.
Custom login forms from page builders or membership plugins may not show the 2FA prompt. In those cases, use the standard login page for accounts that need 2FA.
If a form shows the code field but rejects correct codes, test the same account on wp-login.php. If it works there, the problem is the custom form.
Why do apps and XML-RPC logins stop working?
Wordfence can require 2FA for XML-RPC requests, which blocks apps and services that log in through XML-RPC without a way to send a code.
Mobile apps, some publishing tools and older integrations log in through XML-RPC. They cannot answer a 2FA prompt.
In the Login Security settings, review the option for XML-RPC and two-factor. You can either require 2FA, which blocks those logins, or disable XML-RPC entirely if you do not use it.
For modern integrations, application passwords are a better option. The WordPress application passwords documentation explains how they work.
What other Wordfence settings affect 2FA?
Role requirements, grace periods, and the remember-device option all change how 2FA behaves, and misunderstanding them can look like a bug.
Key settings to check in Login Security:
- Required roles: when 2FA is required for a role, users without it set up may be blocked after any grace period ends.
- Grace period: gives users time to set up 2FA before being locked out.
- Remember device: lets a browser skip the code for a set time. Clearing cookies removes this.
- reCAPTCHA: a separate feature that can block logins if scores are strict.
If users report being locked out on a specific date, check whether a grace period ended. Our guide to Wordfence settings explains each option.
How do you avoid 2FA problems in the future?
Store recovery codes safely, keep at least two administrator accounts with 2FA, and keep your phone's clock on automatic.
A few habits prevent almost every lockout:
- Save recovery codes in a password manager, not only on the same phone.
- Use an authenticator app that supports encrypted cloud backup or device transfer.
- Keep a second admin account owned by a trusted person.
- Document how to reach FTP or your host's file manager.
- Test login after major Wordfence or WordPress updates.
If a problem continues after all these checks, post on the Wordfence support forum with your WordPress and Wordfence versions and the exact message you see. Never share your codes or secret key.
Frequently asked questions
Why does Wordfence say my 2FA code is invalid?
The most common reason is a clock mismatch between your phone and the server. Turn on automatic time on your phone and try again. If it still fails, check you are using the right app entry for that site and ask your host to confirm the server time.
What do I do if I lost my phone with Wordfence 2FA?
Log in with one of the recovery codes Wordfence gave you during setup. If you do not have them, ask another administrator to deactivate 2FA for your account. As a last resort, rename the Wordfence plugin folder through FTP to log in.
Is it safe to rename the Wordfence folder to get in?
It is safe as a short-term fix, but your firewall and scanner are off while the plugin is deactivated. Log in, rename the folder back right away, reactivate Wordfence and set up 2FA again for your account.
Which authenticator apps work with Wordfence?
Any app that supports standard time-based one-time passwords works, including Google Authenticator, Microsoft Authenticator and many password managers. Choose one that supports backup or device transfer so a lost phone does not lock you out.
Can I use Wordfence 2FA on WooCommerce login forms?
Yes, Wordfence Login Security has options for WooCommerce login and registration forms. Turn them on in the Login Security settings. Other custom login forms may not support the 2FA prompt, so test each form before requiring 2FA.
Sources
- Two-factor authentication Wordfence Help
- Legacy two-factor authentication Wordfence Help
- Wordfence Security plugin WordPress.org
- Application Passwords integration guide Make WordPress Core
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


