Blog

Locked out by two-factor authentication on WordPress: regaining access and enabling it for each administrator

Locked out by two-factor authentication on WordPress, or surprised that it only appears for every other administrator: this article gives you the likely cause for each case and how to take back control without breaking everything. You will also learn how to set it up so that every sensitive account is covered and no one is left locked outside.

Locked out by two-factor authentication on WordPress: regaining access and enabling it for each administrator

Key points

  • If 2FA only appears for one administrator, first check their WordPress role: nexya Pro applies it to the selected roles.
  • A TOTP code refused even though the phone is present usually comes from a mismatched clock.
  • Lost phone: renaming the extension folder via FTP restores password access, provided you reactivate it right after.
  • With a passkey, the password form always stays underneath: losing it does not lock you out.
  • Test email delivery before getting locked out, otherwise the unlock link will not arrive.

Locked out by two-factor authentication: three different situations

Being locked out by two-factor authentication on WordPress actually covers three problems that forums often mix up. One administrator never sees the code step while their colleague does. Another changed phones and their app no longer gives the correct code. A third added a passkey and can no longer log in from another device.

Each case has its own cause and solution. Before touching the site’s files, it is worth knowing which one you are in.

A quick vocabulary point for later. In nexya, two-factor authentication is part of nexya Pro: it is a two-step login using a TOTP code, the six-digit code displayed by an authenticator app on the phone. It applies to the roles you choose, not to a list of people.

Viewing the site through the eyes of a role allows you to verify what an account can really do, and thus whether it needs to go through the code.
Viewing the site through the eyes of a role allows you to verify what an account can really do, and thus whether it needs to go through the code.

2FA only shows up for one administrator out of two

This is the most frequent question, and the answer almost always comes down to the role. Since nexya Pro’s two-factor authentication targets roles, an account that does not have one of these roles is not affected, even if it has almost all privileges.

The trap is common: the person managing the site is called an “administrator”, but their WordPress role might be something else. Shop manager, editor, role created by a membership plugin, or left behind by a former developer: these roles sometimes carry many capabilities without being called Administrator. If you only checked the latter, the second account passes without a code.

To check this, the free Roles & Capabilities module organizes capabilities under the content type that creates them, making it clear what a role can actually do. It also allows you to view the site through the eyes of a role without leaving your own account. A role that can install plugins or modify users deserves two-factor authentication, regardless of its name.

Second possible cause: the TOTP code is configured on a person-by-person basis. Choosing a role does not register it in everyone’s app. Ask each holder of an affected account to confirm they have completed this step, rather than assuming it.

Third cause: two plugins each offering their own two-factor authentication. Depending on the loading order, one or the other shows up, or neither. Keep only one.

An account that can install plugins is an administrator account, whatever the name of its role.

Lost phone or code refused: regaining access

If you have the phone but the code is refused, check the time first. A TOTP code is calculated from the current time and changes about every thirty seconds. A phone clock off by a minute or two is enough to make every code get rejected. Set the time back to automatic adjustment, then try again. If several people have the same problem at the same time, the server time is at fault: that is a question for your host.

If the phone is lost, or if the app was reinstalled without a backup, the secret that generated the codes disappeared with it. You then have to go through the site’s files.

Via FTP or your host’s file manager, open the wp-content/plugins folder and rename the nexya plugin folder, for example by adding “-off” to the end. WordPress disables it upon the next load, and access reverts to password only. Log in, rename the folder back to its original name, reactivate the plugin, and then re-register the code in the app.

Do it quickly. nexya is a single plugin: while it is disabled, all its modules are as well, including the firewall and cookie banner. Renaming a folder does not delete anything in the database.

Setting up two-factor authentication for each administrator without getting locked out

  1. 1

    List sensitive accounts and their role

    Identify each account that can install extensions, modify users, or change settings. In the free Roles & Capabilities module, note everyone's actual role, not their job title.

    List sensitive accounts and their role
  2. 2

    Choose the roles subject to the code

    In nexya Pro's Security module, choose all the roles identified in the previous step, not just Administrator. Keep only one active two-factor authentication extension on the site.

    Choose the roles subject to the code
  3. 3

    Verify that the site's emails are sending

    The unlock link after failed logins is sent by email. Set up the sending method in the Mail module and send a test message before activating anything.

    Verify that the site's emails are sending
  4. 4

    Have everyone register the code, then check

    Each person registers the code in their app and, if desired, a passkey per device. Test a login in a private window while staying logged in in another, and keep your FTP access handy. The activity log will then show you who changed what.

    Have everyone register the code, then check

Passkeys: the password is always kept underneath

Since version 1.6.6, nexya Pro allows logging in with a passkey: fingerprint, face, or device lock. Each person adds them to their profile, up to ten, each with a name and the date of last use.

The important point regarding lockouts: the password form is always displayed underneath as a fallback. A lost passkey therefore does not close the door. You log in with the password, then the TOTP code if the role is subject to it.

A passkey counts for both steps of the two-step login and bypasses the login captcha. It closes the password path for that request only, not for subsequent ones.

If the passkey is not offered on another computer, it is generally because it is kept on the device where it was created, or in a password manager that is not synchronized. Add one passkey per device, with a clear name: the last use date will then tell you which ones to remove.

After logging in with a password, a notice suggests adding a passkey. Postponing it defers it by 30 days.

The email log shows if the unlock link was sent, and if not, the reason given by the server.
The email log shows if the unlock link was sent, and if not, the reason given by the server.

It is not always two-factor authentication that blocks you

A screen refusing access is not necessarily related to the code. The free Security module limits failed logins: after several attempts, it locks the login for 15 minutes, then in stages up to 24 hours, and sends an unlock link by email.

This link is only useful if it arrives. The Mail module, which is also free, sends the site’s emails via SMTP or an API provider, keeps a log of each message, and gives the exact reason for an email rejected by the server. Send a test message before you need to, not on the day you find yourself locked out.

The free activity log shows who changed what, with the before and after. It helps understand why an account no longer has the expected role.

What nexya does not fix: a server error, a redirection loop, or a broken extension code that prevents the login page from displaying. These cases are the responsibility of the host or developer.

What is free, what is nexya Pro

The free version does not contain the two-step verification code. nexya Pro is sold on nexya.dev, delivered by Freemius after purchase, and takes over from the free extension with the same settings.

  • Free: failed login limit with unlock link, Roles & Capabilities module, Mail module and its log, activity log.
  • nexya Pro: TOTP two-factor authentication for chosen roles, passkey login with the password as a fallback.
  • Multisite networks are not supported: the extension remains disabled there and reports it.

FAQ

Why doesn't my second administrator have to enter a code?

In nexya Pro, two-factor authentication applies to selected roles. If this account has another role, such as shop manager or a role created by an extension, it is not affected as long as that role is not checked.

I lost my phone and no longer have the code, how do I log back in?

Rename the nexya extension folder in wp-content/plugins via FTP or your host's file manager. Login reverts to password only. Then rename the folder back, reactivate the extension, and save the code in your app again.

Can a passkey lock me out of the admin area?

No. With nexya Pro, the password form is always displayed below the passkey as a fallback option. A passkey only closes the password path for the current request.

Is two-factor authentication included in the free version?

No. Two-step verification and passkeys are part of nexya Pro. The failed login limit, with its email unlock link, is free.

The modules in this post

nexya security nexya roles nexya mail nexya activities

Try nexya Pro free for 7 days

Every module, forms, newsletters and the page cache, on your site. No commitment.

See the plans Or discover the free version