Skip to content
Secureweb Prespa dark mode logo
Secureweb

Secure Your Website Now

  • Home
  • Contact
  • Blogs
  • Free Scan
    • Free Security Test
    • Free Website Scanner
  • en
    • en
  • Start Now

How to Set Up WordPress Two-Factor Authentication (2FA)

WordPress two-factor authentication in four steps: install a plugin, scan the QR code, verify, and enforce 2FA for every wp-admin user.

blogs Guides
Post read time 4 min read

WordPress powers a large share of business websites in Morocco and around the world, which makes the wp-admin login a constant target for automated password-guessing (brute-force) attacks. WordPress two-factor authentication (2FA) is the single most effective way to shut those attacks down: even if your password leaks in a data breach, an attacker still can’t get in without the second factor.

This guide walks you through setting up WordPress two-factor authentication in four clear steps — from installing a plugin to enforcing it for every administrator — with a screenshot for each step.

WordPress two-factor authentication: a valid password blocked at the 2FA challenge, with an authenticator app code as the second factor
WordPress two-factor authentication stops attackers even when they already have the password.

What is WordPress two-factor authentication?

Two-factor authentication adds a second check on top of your password. After you enter your username and password (something you know), WordPress asks for a short code from an app on your phone (something you have). Even if an attacker has stolen your password, they cannot log in without that second factor.

The most reliable method is TOTP (Time-based One-Time Password): an authenticator app such as Google Authenticator, Microsoft Authenticator, or Authy generates a fresh six-digit code every 30 seconds. It works offline and is far safer than codes sent by SMS, which can be intercepted or redirected through SIM-swapping.

Before you start

  • An administrator account on your WordPress site.
  • An authenticator app on your phone — Google Authenticator, Microsoft Authenticator, Authy, or a password manager that supports TOTP.
  • A few minutes and a safe place to store backup codes (a password manager or a locked drawer).

If more than one person can log in to your site, plan to enable 2FA for every administrator and editor. One unprotected account is enough to undo the protection on all the others.

Step 1 — Install a two-factor authentication plugin

In your dashboard, go to Plugins → Add New and search for “two-factor authentication”. Several trusted options exist; the free, community-maintained Two-Factor plugin from the WordPress.org team is a solid, no-frills choice. Click Install Now, then Activate.

WordPress Add Plugins screen with the Two-Factor Authentication plugin and the Install Now button highlighted
Plugins → Add New: search for a two-factor plugin and click Install Now.

Step 2 — Scan the QR code with your authenticator app

Open your profile under Users → Profile and find the Two-Factor Options section. Choose the Authenticator App (TOTP) method to display a QR code. On your phone, open your authenticator app, tap the + button, choose Scan a QR code, and point the camera at your screen. Can’t scan it? Every plugin also shows a text key you can type in manually.

WordPress user profile Two-Factor Options screen showing a QR code to scan with an authenticator app
Scan the QR code once to link your authenticator app to your account.

Step 3 — Enter the six-digit code and save your backup codes

Your app now shows a six-digit code that changes every 30 seconds. Type the current code into WordPress and click Verify & Enable to confirm the link. WordPress then generates a set of one-time backup codes.

Save these backup codes now. Download or print them and keep them somewhere safe and offline. They are your way back in if you ever lose your phone — and each code works only once.

WordPress screen to enter the six-digit authenticator code and download one-time backup codes
Confirm the code, then store your one-time backup codes somewhere safe.

Step 4 — Enforce WordPress two-factor authentication for all admins

Protecting only your own account leaves every other admin as an open door. In the plugin’s settings (usually under Settings → Two-Factor), turn on Require 2FA for all Administrators — and ideally for Editors too, since they can publish content. Save your changes. Existing users will be prompted to set up their second factor the next time they log in.

WordPress Two-Factor Settings with the Require 2FA for all Administrators toggle enabled
Require two-factor authentication for every administrator, not just your own account.

Test your setup — and what to do if you get locked out

Log out and sign back in. After your password, WordPress should now ask for a code from your app. Enter it to confirm everything works.

If you ever lose access to your authenticator app, log in with one of your backup codes. If you have no codes either, an administrator can temporarily disable 2FA by connecting over SFTP/FTP and renaming the plugin’s folder inside wp-content/plugins/. That switches the plugin off so you can regain access — then simply set it up again.

Frequently asked questions

Does two-factor authentication slow down every login?

Only slightly — you enter one extra six-digit code. Most plugins let you mark your own computer as a trusted device, so you are not asked for a code on every visit.

Is an authenticator app better than SMS codes?

Yes. SMS codes can be intercepted or redirected through SIM-swapping. A TOTP authenticator app generates codes on your device, works offline, and is the recommended method.

What if I manage several WordPress sites?

Repeat these steps on each site. A single authenticator app can hold codes for many accounts, so you can manage them all from one place.

WordPress two-factor authentication: the bottom line

Two-factor authentication is one of the highest-impact, lowest-cost security controls you can add to a WordPress site. It neutralises the password-guessing and credential-stuffing attacks that make up the bulk of login attempts. Pair it with strong, unique passwords, keep WordPress, your theme, and your plugins updated (see the official Hardening WordPress guide), and review the rest of our checklist for securing a WordPress website.

Want an expert to check your defenses? SecureWeb offers a free website security scan and hands-on security audits built for Moroccan businesses — a quick way to find the gaps before an attacker does.

Secure Your website with Secureweb

🔒 Get Started

Follow Secureweb

  • WhatsApp
  • Facebook
  • YouTube
  • Instagram

Posts navigation

< Website Security Audit Checklist – Protect Your Business Today
Critical WordPress wp2shell Vulnerability Under Active Attack — Update Now >

Related Posts

Bank Al-Maghrib Phishing Crackdown: New Rules for Banks in 2026
blogs News
Bank Al-Maghrib Phishing Crackdown: New Rules for Banks in 2026
Critical WordPress wp2shell Vulnerability Under Active Attack — Update Now
blogs News
Critical WordPress wp2shell Vulnerability Under Active Attack — Update Now
Website Security Audit Checklist – Protect Your Business Today
blogs
Website Security Audit Checklist – Protect Your Business Today

secureweb

Hackers knock. We don’t answer. Join SecureWeb and keep your door shut.

Need Help?

Contact

Reviews

Get Started

Cybersecurity Consulting

Learn More

Services

Pricing

Free Cybersecurity Tools

Learn Cyber security

Get in Touch

contact@secureweb.ma

Stay Informed:

© Copyright 2026 secureweb. All rights reserved
Newsletter Signup

Stay ahead of cyber threats

SecureWeb's Morocco-focused security briefings, straight to your inbox. No spam, unsubscribe anytime.

Free Security Assessment




    Secure Coding

    Protect Your Code. Secure the Future.




      Bug Bounty Program Request




        Secureweb Premium Plan

        Say goodbye to hackers




          Premium Scanner




            Secureweb Basic Plan

            Ideal for small websites