Two-factor authentication (2FA) for WordPress
Passwords alone are no longer sufficient to protect your WordPress website. Hackers use brute force attacks, stolen password lists, and phishing to gain access. Two-factor authentication (2FA) adds an extra security layer that protects your account, even if your password leaks.
What is two-factor authentication?
Two-factor authentication requires two different forms of identification to log in:
- Something you know: your password
- Something you have: your phone with an authenticator app
Without both factors, logging in is impossible. A hacker with your password still cannot log in without also having your phone.
Why 2FA is essential for WordPress
WordPress is the most used CMS in the world, which also makes it the biggest target for hackers. Millions of brute force attacks are carried out daily on WordPress login pages. With 2FA enabled, these attacks are pointless because even the correct password is not enough.
Additionally, 2FA protects you against:
- Passwords that have leaked via a data breach
- Keyloggers that capture your password
- Phishing attacks where you unintentionally give away your password
- Employees with access to shared passwords
The best 2FA plugins compared
There are various plugins to implement 2FA in WordPress. These are the most reliable options:
Wordfence Security
If you already use Wordfence for firewall and malware scanning, the built-in 2FA feature is the logical choice. It is completely free (also in the free version) and works with any TOTP authenticator app. Read our extensive Wordfence guide for installation instructions.
Advantages of Wordfence 2FA:
- Completely free
- Integrated with firewall and login security
- Supports all standard TOTP apps
- Backup codes automatically generated
WP 2FA
WP 2FA is a dedicated two-factor authentication plugin that offers more advanced options. The free version supports TOTP authenticator apps, while the premium version also offers SMS and email codes.
Advantages of WP 2FA:
- Detailed policy settings per user role
- Require 2FA for specific roles (e.g., only admins)
- Grace period for users to set up 2FA
- Whitelabeling for professionals
Google Authenticator plugin
A lightweight option if you only want 2FA without extra features. Works exclusively with Google Authenticator or compatible apps.
Step-by-step setup with Wordfence
We walk through the installation with Wordfence, the most complete free option:
1. Install Wordfence
Go to Plugins > Add New and search for "Wordfence". Install and activate "Wordfence Security - Firewall, Malware Scan, and Login Security".
2. Activate 2FA
Go to Wordfence > Login Security in your WordPress admin. You will now see the 2FA setup page.
3. Prepare authenticator app
Download an authenticator app on your phone. Recommended options:
- Google Authenticator (Android/iOS) - simple and reliable
- Microsoft Authenticator (Android/iOS) - with cloud backup
- Authy (Android/iOS/Desktop) - synchronization between devices
4. Scan QR code
Open your authenticator app and scan the QR code that Wordfence displays. Your app will now generate a new 6-digit code every 30 seconds.
5. Enter verification code
Enter the current code from your authenticator app to confirm everything is working. Click "Activate" to enable 2FA.
6. Save backup codes
Wordfence automatically generates recovery codes. Download or print these codes and store them in a safe place (not on the same computer!). You will need these if you lose your phone or it breaks.
Safely storing backup codes
Backup codes are your lifeline if you no longer have access to your authenticator app. Treat them as highly confidential:
- Print them and store them in a safe or locked drawer
- Store them in a password manager like Bitwarden or 1Password
- Make an encrypted backup on a USB stick that you keep separately
- Never store them in your email, on your desktop, or in an unsecured notes app
Each backup code is single-use. After using one, generate new codes in your WordPress admin.
Requiring 2FA for all users
If you have multiple users on your WordPress site, you can require 2FA. In Wordfence, go to Login Security > Settings and enable "Require 2FA for all administrators".
With WP 2FA, you have more control and can set per user role:
- Which roles must use 2FA
- A grace period in which users must set up 2FA
- What happens when the grace period expires
Frequently asked questions
What if I lose my phone?
Use one of your backup codes to log in. Then immediately go to Login Security and set up 2FA again with your new phone. Generate new backup codes.
Can I disable 2FA for certain users?
Yes, in the plugin settings you can specify for which user roles 2FA is required. We recommend securing at least all Administrator and Editor accounts.
Does 2FA work with WooCommerce?
Yes, 2FA protects the WordPress login. This also applies to users who log in via WooCommerce. You can make 2FA optional for customers and mandatory for administrators.
How do I log in if the codes do not work?
Check if the time on your phone is correctly set (automatic time). If the codes do not work and you do not have backup codes, you can disable 2FA via the database or by deactivating the plugin via FTP. Contact support if you need help with this.
Additional security tips
2FA is an important step, but combine it with other security measures:
- Use strong, unique passwords for each account
- Keep WordPress, plugins, and themes up to date
- Make regular backups with UpdraftPlus
- Limit the number of admin accounts to the minimum
- Consider changing the wp-admin URL
At Theory7, we take security seriously. All our hosting packages include Patchman malware scanning, and our support staff are ready to help you secure your WordPress website.
0 van 0 vonden dit nuttig