WordPress 2FA: how to enable two-factor authentication for wp-admin
· The AYT team · 6 min read

Two-factor authentication (2FA) in WordPress asks, after your password, for a 6-digit code generated by an app on your phone, such as Google Authenticator or Microsoft Authenticator. The code changes every 30 seconds, so a stolen password is no longer enough to get into wp-admin. WordPress has no 2FA built in, but you can add it with a plugin in about 10 minutes.
Why 2FA is worth it on wp-admin
Every WordPress site has a wp-login.php page, and bots try passwords on it day and night, usually from lists of passwords leaked from other sites. If an administrator uses the same password somewhere else, the attacker already has it. With 2FA, the right password no longer opens the account without your phone.
Turn on 2FA at least for the accounts that can change the site: administrators, editors and, on a WooCommerce store, shop managers. For customers who create an account at checkout it can stay optional.
Which 2FA plugin to choose
Three free plugins from WordPress.org cover almost every case:
| Plugin | Made by | Methods | Good for |
|---|---|---|---|
| Two Factor | WordPress.org contributors | app (TOTP), email code, backup codes | a site with 1–3 administrators |
| WP 2FA | Melapress | app (TOTP), email code, backup codes | teams: you can require 2FA per role, with a grace period |
| Wordfence Security | Wordfence | app (TOTP) and recovery codes, in its Login Security section | if you already use Wordfence for its firewall and scanner |
If you have the separate "Wordfence Login Security" plugin, check it: it was closed on WordPress.org in August 2026 and no longer gets updates. Replace it with one of the plugins above.
Our recommendation: Two Factor for a small site with a single administrator, because it does one thing and adds no other screens. WP 2FA when several people have access and you want each of them to be required to set up the second step.
How to enable 2FA with the Two Factor plugin
- In wp-admin, go to Plugins → Add Plugin, search for "Two Factor", install it and activate it.
- Open Users → Profile and scroll down to the "Two-Factor Options" section.
- Tick the "Authenticator App" method. The plugin shows a QR code.
- On your phone, open the authenticator app, tap "Add account" and scan the QR code.
- Type the 6-digit code from the app into your profile, so the plugin can check that your phone and the server generate the same codes.
- Tick "Backup Codes" as well, generate the codes and keep them in a password manager or on paper, not on the phone that generates the codes.
- Save the profile.
Before you close the page, test it: open a private window in your browser and sign in again. If it asks for the code after the password and accepts it, 2FA works. The session in the first window stays open, so you can fix the settings if something goes wrong.
Each administrator turns on 2FA from their own profile, because only they have their phone. With WP 2FA you can require every administrator and editor to do it at their next sign-in.
If you lose your phone
You have three ways back in, in this order:
- Use a backup code instead of the code from the app. Each code works once.
- Ask another administrator to switch off 2FA on your profile (Users → edit the user), then set it up on your new phone.
- If you are the only administrator and have no backup codes, disable the plugin through the files. Open the File Manager or an FTP client, go to
wp-content/plugins/and rename the plugin's folder, for example fromtwo-factortotwo-factor-off. WordPress deactivates the plugin and you sign in with your password alone. Once you are in, give the folder its old name back, activate the plugin and set up 2FA on the new phone.
The third way also shows the limit of plugin-based 2FA: anyone with access to the site's files can get around it. That is why your FTP password and your hosting panel password need the same protection as wp-admin.
What else protects the login
2FA stops stolen passwords, but you still need the rest:
- A long, unique password for each administrator, kept in a password manager.
- As few administrator accounts as possible. People who write posts need the Editor or Author role.
- Delete the accounts of people who no longer work on the site.
- Disable XML-RPC if you don't use the WordPress mobile app or Jetpack, because passwords can be tried through it too.
If you suspect someone is already inside the account, 2FA won't help any more. Read what to do with a hacked WordPress site first.
Frequently asked questions
Does 2FA slow down the site?
No. The plugin only runs at sign-in. Visitors reading the site never go through it.
Can I get the code by email instead of an app?
Yes, Two Factor and WP 2FA also offer an email code (Wordfence's 2FA works with the app only). It is weaker: anyone with access to your mailbox also gets the code. And if the site doesn't send email reliably, you are locked out. The phone app doesn't depend on email.
What if the code from the app is not accepted?
TOTP codes depend on the exact time. Check that the date and time on your phone are set automatically from the network. If the server's clock were wrong, every user would have the problem at once.
On AYT hosting
On AYT, the WordPress login also has protection at server level, before a request reaches the site: login rate limiting, blocking of IP addresses that keep trying passwords (CrowdSec) and the ModSecurity firewall. The security checklist in the WordPress Toolkit switches off XML-RPC, file editing in wp-admin and author scanning from the panel.

Your AYT account and the control panel have their own two-factor authentication, separate from WordPress. Turn that on too, because the panel gives access to the site's files. See what each plan includes on the WordPress hosting page.
