Build your WordPress website with Elementor.Discover Elementor Affiliate link
Français

Site appearance

Login and accounts · Intermediate

Wordfence: recover access when 2FA codes are rejected or lost

Lost phone or rejected Wordfence codes? Check the clock, use a recovery code, or reset the factor for only the affected account.

Source published: · Source updated: · Editorial policy

Read the French edition

Identify the step rejecting the login

The password is recognized, then Wordfence requests an additional code that is rejected. Or the phone has been lost and no code can be generated. This block concerns the second authentication factor, called 2FA. Resetting only the WordPress password does not recreate that factor or restore the phone application.

Start by identifying the exact site and account. An app may retain several entries with similar names, particularly after a copy or domain change. A code for an old site or another administrator does not necessarily match the secret saved for your current account.

The desired result is a verified login, followed by reliable new pairing when the old device is no longer available. We prioritize recovery of the affected account. Disabling the second factor for every user, expanding an address allowlist, or deleting all security data is not a proportionate response to losing a phone.

Check which module is actually in use

This guide addresses the local second factor of an existing Wordfence Security installation. The directory listing consulted specifies version 9.0.2, published by Mark Maunder, requiring at least WordPress 4.7 and PHP 7.0, with compatibility declared up to WordPress 7.1.4. These details describe the product and do not guarantee compatibility with a custom login page.

The Wordfence service account, WordPress login, and an integration using an application password are different forms of access. If the screen belongs to the external service, use its own recovery process. A loop back to the form without an explicit code request may also involve cookies or a redirect, which should be examined separately.

On a network installation, involve the network owner when roles and settings are shared. A subsite administrator does not automatically have permission to reset every account. No new plugin is necessary: layering two authentication mechanisms during recovery would make the process harder to understand and restore.

Prepare recovery without losing the last session

If an administration session still works in another browser, keep it open. Do not immediately delete the authenticator app entry or uninstall the app: it may contain the only usable access to other services. Correcting the time or simply choosing the right entry may still resolve the problem.

Before a file-based change, keep a consistent private backup and a way back. For the first code-based or account-based methods, primarily record who is intervening, for which user, and with what identity evidence. Do not share a QR code, pairing secret, or recovery code in a public forum.

Prepare a second browser window for the final check. The principle is to test a new login without closing the session that allows settings to be corrected. If an organization manages the account, follow its recovery procedure instead of asking a colleague to use their credentials for you. The intervention must remain attributable to the authorized owner and the single account actually blocked.

Check the current code and clocks

A TOTP code depends on time and the secret shared between the site and app. Choose the entry for the correct site, then wait for a new code to begin instead of repeatedly submitting one about to expire. Respect the announced delay if the site limits attempts.

In the phone settings, check the date, time, and automatic synchronization. A displayed time that looks approximately correct does not guarantee a sufficiently small offset. WordPress’s display timezone is not a command for synchronizing the server clock.

  1. Confirm the site, account, and app entry.
  2. Check device synchronization, then try one newly generated code once.
  3. With an authorized session, open Login Security, then the 2FA page, and compare Server Time and Browser Time.
  4. If server time is incorrect, have the host correct its synchronization. Wordfence’s NTP check may be unavailable without this proving that the clock is wrong.
  5. If rejection persists, keep the message and move to recovery instead of accumulating attempts.

Use a saved recovery code

Recovery codes kept during activation let you log in without the phone. They are longer than temporary codes, and each can be used only once. Use only the current set for the relevant site and account; a set replaced by a later generation must no longer be considered valid.

Look for your copy in private storage or the document kept during pairing. Avoid copying it into a sharing tool to simplify entry. If the codes were stored only on the lost phone, they do not provide an independent recovery route.

  1. Open the real login page and enter your usual WordPress credentials.
  2. At the 2FA prompt, enter an unused recovery code instead of the temporary code.
  3. Submit once, then mark that code as used in your private copy.
  4. If access returns, keep the session open and prepare new pairing.
  5. If the code is rejected, check the set and account. Do not publish the list to ask which might work.

Reset your factor from a retained session

A session that is still authorized may allow you to replace the account’s factor without interrupting other users’ protections. Open Wordfence > Login Security, then My 2FA. Check that the page concerns your account before using Deactivate to remove its old pairing.

Have the new device and recovery-code storage ready already. Deactivation must be followed by reinstating the intended factor. If a policy requires 2FA, access may require new enrollment; do not change the role policy for every administrator to bypass that requirement.

Keep this session during setup and the first check in another window. If you cannot open the page or reauthentication requests precisely the lost factor, do not try changing unknown database values. Use another authorized administrator or the host’s recovery process. An old session must not become an excuse to leave a sensitive account without a factor permanently or to share its browser with someone whose identity has not been verified.

Involve another authorized administrator

An administrator still logged in can reset a user’s factor after verifying their identity. The request must use an already known channel: merely knowing an account name or sending an urgent message is insufficient. Agree on a time when the owner can immediately configure their new device.

The intervention concerns this user’s 2FA record. It does not require giving every member the administrator role or globally stopping login security. On a network, use the permissions and context appropriate to the affected account.

  1. In Users, find the exact profile and confirm the identity with the owner.
  2. Under the username, open the 2FA link provided by Wordfence.
  3. Check the User label and name displayed on the management page.
  4. Use Deactivate for only that user’s old factor.
  5. Have the new pairing configured and a new login checked. Keep evidence of this completion; successful deactivation is not enough to guarantee that the account is protected again.

Respect factor requirements and individual grace periods

Wordfence can allow, prohibit, or require 2FA by role. A recently reset account’s behavior therefore depends on that policy. Before changing a rule, check whether the block comes from the code, mandatory enrollment, or an expired grace period.

In Login Security > Settings, role settings describe the general scope. An intervention on one user does not justify making 2FA optional for every administrator. When an individual grace period is truly needed, the owner can use the grace control on that user’s Profile, 2FA, or Passkeys page and set an appropriate duration. Administrators and super administrators do not receive the default grace period; any individual period must be explicitly decided and then followed through to new enrollment.

Do not confuse this grace period with recovery of an old secret: it does not restore the lost app. It merely organizes the time allowed to complete the intended configuration. Document the person helped and the expected result, then check that new pairing is completed before the deadline. Passkeys and other mechanisms can change the login flow; if required on the site, have their own policy addressed rather than changing 2FA to repair another factor.

Prepare file access as a last resort

If neither a recovery code nor an available administrator enables access, Wordfence documentation provides for temporarily interrupting the plugin by renaming it. This route requires SFTP or an authorized file manager and certainty that you are working on the correct installation. It temporarily reduces the product’s protection; prepare a brief intervention with the owner.

Identify the actual Wordfence Security folder and its firewall configuration. Extended protection may load before WordPress; do not delete its loader files or PHP directives to apply generic advice. If the provider manages deployment or the firewall, have its owner prepare this specific recovery.

Keep the backup and initial name. Check that no destination folder already has the chosen name. Do not rename the entire plugins directory or essential plugins. Do not apply this procedure to another publisher’s component that also displays a 2FA request. The aim is a temporary opening to repair the account, not uninstalling the security system or erasing its data.

Restore the plugin promptly after temporary access

In the confirmed installation’s file access, the usual folder is generally wp-content/plugins/wordfence. Adapt the path if the content directory is customized. The temporary name wordfence-disabled follows the documented recovery process; do not delete the folder.

Keep the browser and file access available during the operation. If login remains blocked or a server error appears, stop the procedure, restore the initial name, and have the owner examine loading. Repeated renaming or randomly removing other protections would not clarify the diagnosis.

  1. Rename only the identified folder to wordfence-disabled during the prepared time window.
  2. Try a WordPress login using the account’s legitimate credentials.
  3. Once logged in, keep the session and immediately restore the original name wordfence.
  4. Click Dashboard to refresh the menu after the folder returns. If Wordfence remains absent, open Plugins and reactivate it if necessary, then reopen its menu.
  5. In Login Security, deactivate your account’s old factor if necessary and immediately prepare its replacement.
  6. Then check the plugin state and intended protection. Restoring a folder name does not by itself validate the firewall.

Create new pairing and renew recovery codes

Open Login Security > My 2FA in the retained session. Add a new entry in your app and use the QR code or manual secret on that page. Do not share a screenshot of the QR code: it contains what is needed to generate the account’s future codes.

Download the new recovery-code set into private storage available even if the phone disappears. Wordfence invalidates old codes when a new set is generated. An old copy must therefore be clearly set aside to avoid confusion during the next incident.

Enter a current code and use Activate to complete pairing. An entry merely being present in the app does not prove that the site validated activation. Wait for confirmation, then move to the check in another window. Delete obsolete old entries only after unambiguously identifying the new site and account. If the device was genuinely lost, also review with the owner other access that may have been stored there, without indiscriminately resetting every site account.

Test without closing the session that allows corrections

Keep the maintenance session open and start a new login in a private window or second browser. Use the same account, usual password, and a newly generated code. Do not use an already remembered device as the only check, since it may skip the code request.

The expected result is the correct flow appearing, acceptance of the new code, and access to the appropriate dashboard. If a custom login page fails while the standard WordPress form works, have its integration examined instead of repeating pairing several times.

  1. Verify a fresh login with the new code.
  2. Check that 2FA is active for the account and roles have not been broadened.
  3. If the file-based fallback was used, confirm the plugin name and activation as well as the expected protection.
  4. Check that the new recovery codes are retrievable from their private storage.
  5. Then close unnecessary test sessions and record the result. Restored access without a factor is not the normal endpoint of this recovery.

Prevent another loss and reverse an incorrect change

Keep a recovery method independent of the primary device and an authorized maintenance contact. Identify app entries by site and account, especially when managing copies. A new phone or restored app requires checking before erasing the old device.

If a change affected the wrong account, restore its protection with its owner and check available logs. Do not try reconstructing an old secret from values found in the database. If a folder was renamed without resolving the problem, restore its name and initial state before pursuing another diagnosis.

Rolling back a factor does not mean putting a device reported lost back into service. It means preserving or restoring the legitimate policy, then pairing an available, controlled device. Record the steps actually performed, sessions used, and final account state. Include neither recovery codes, secret, nor password in this record. This trace distinguishes authorized recovery from a deactivation accidentally left open.

Prepare recovery evidence without retaining a secret

The recovery record can remain very simple: affected account, exact site, method used, new pairing time, and fresh-login result. In the “recovery codes” column, record only that independent storage is confirmed; do not copy any code. A useful screenshot shows the active state, never the QR code or pairing key.

Three situations require different decisions. If the phone still works but codes fail, check the selected entry and synchronization before removing the factor. If the phone is lost but a recovery code exists, use that code and then replace the pairing. If only another administrator can act, have the identified account reset and immediately arrange restoration of 2FA. These approaches use the free features already present; an additional plugin does not restore the old secret.

The final check must produce a new code request and accept the code from the new device. An already open session does not validate this test. If only the custom login page fails, keep the working pairing and pass this integration case to the maintainer.

Rollback depends on the stage: a general setting tested can be restored to its initial value, but a replaced secret is not recovered by restoring an old database on the active site. Preserve the maintenance session, correct the new enrollment, and verify the account again. Do not put a device reported lost back into service.

Sources and references

Use these references to check the features, requirements and limitations described. Reading documentation is not a practical test.

View 5 references

English translation of the reviewed French edition. Code examples retain their original identifiers, comments and output strings for reproducibility. Linked exercise files and original screenshots may contain French. No new practical tests or price checks are implied by translation.

Continue reading in English