Skip to content

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

5 min read

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

A strong password isn’t enough anymore: passwords leak, get reused and get guessed by bots. Two-factor authentication (2FA) adds a second step to logging in, a six-digit code from your phone, so a stolen password alone can’t open the account. This guide explains how 2FA works in WordPress and how to turn it on for your admin login, your members and your WooCommerce customers with WP ULike Pro.

Short answer: go to WP ULike → Settings → Login & Signup, turn on Enable 2-factor Authentication, and add the [wp_ulike_pro_two_factor_setup] shortcode to a profile tab or account page. Users scan a QR code with an authenticator app, and from then on they enter a code after their password.

What is two-factor authentication?

Two-factor authentication asks for two different things when you sign in: something you know (your password) and something you have (your phone). WP ULike Pro uses TOTP, the time-based one-time passwords behind apps like Google Authenticator: your phone shows a new six-digit code every 30 seconds, and the site only accepts the current one.

Authenticator apps are safer than codes sent by text message, work without a phone signal, and are free: Google Authenticator, Microsoft Authenticator, Authy, 1Password and any other TOTP app all work.

Which logins are protected

Once a user turns on 2FA, WP ULike Pro asks for their code wherever they sign in with a password, not only on its own forms:

Where the user signs inWhat happens
WP ULike Pro login formAsks for the code after the password
The standard WordPress login (wp-login.php), including adminsAsks for the code after the password
WooCommerce My Account loginAsks for the code on the same page
Other plugins’ login forms (for example Ultimate Member or MemberPress)Refuses the login and points to your login page, so 2FA can’t be bypassed
XML-RPCRefuses the account password
Application passwords (REST API, mobile apps)Keep working

Social logins skip the code, since the user already verified with Google, GitHub or another provider. Accounts without 2FA sign in exactly as before.

How to set up 2FA in WordPress

Step 1: Turn it on

Go to WP ULike → Settings → Configuration → Login & Signup, turn on Enable 2-factor Authentication and save.

WP ULike Pro Login and Signup settings with Enable 2-factor Authentication turned on
The 2FA switch under Login & Signup.

Step 2: Add the setup page

Users need a place to connect their phone. Add [wp_ulike_pro_two_factor_setup] to a tab on their user profile or to the edit-account page.

Step 3: Users connect their authenticator app

  1. Open the setup page while logged in.
  2. Scan the QR code with an authenticator app.
  3. Type the six-digit code from the app and submit.

The phone now appears in their list of devices. Users can add several devices (up to 5 by default) and remove old ones from the same page.

Two-factor authentication setup screen inside a WP ULike Pro user profile
Members connect their authenticator app from their own profile.

Step 4: Sign in with a code

From now on, users enter their username and password as usual, then the current code from their app. A wrong or expired code shows a clear message, and they can simply try the next one.

Two-factor authentication for WooCommerce

Customer accounts hold addresses and order history, so they deserve protection too. With WP ULike Pro active, customers who turn on 2FA are asked for their code right on the WooCommerce My Account login, without being sent to wp-login.php. Put the setup shortcode on a My Account tab or a page you link from it.

Tips for a smooth rollout

  • Start with admins and editors, the accounts that can do the most damage, then encourage members.
  • Exclude the login and 2FA setup pages from page caching (LiteSpeed, WP Rocket and others).
  • Test in a private window before telling users about it.
  • If someone loses their phone, an administrator can turn off 2FA for that account in the WordPress user settings.
  • Combine it with Google reCAPTCHA, email verification and social login, all under the same Login & Signup settings.

2FA is part of WP ULike Pro’s login, signup and profile tools. See everything that’s included in WP ULike Free vs Pro.

Frequently asked questions

How do I add two-factor authentication to WordPress?

With WP ULike Pro, turn on Enable 2-factor Authentication under WP ULike → Settings → Login & Signup, then add the two-factor setup shortcode to a profile or account page. Users scan a QR code with an authenticator app to finish.

Does it protect the WordPress admin login?

Yes. Users with 2FA turned on are asked for their code on the standard wp-login.php page too, including administrators.

Does it work with WooCommerce?

Yes. Customers with 2FA are asked for their code on the WooCommerce My Account login form.

Which authenticator apps can I use?

Any app that supports TOTP codes, such as Google Authenticator, Microsoft Authenticator, Authy or 1Password.

What if a user loses their phone?

An administrator can turn off two-factor authentication for that account in the WordPress user settings, and the user can set it up again on a new device.

Does 2FA work with social login?

Social logins don’t ask for a code, because the user already signs in through Google, GitHub or another provider.

Is two-factor authentication free in WP ULike?

No. Two-factor authentication is part of WP ULike Pro, along with login and signup forms, profiles and social login.

Enjoyed this article?

Get more WordPress tips like this in our monthly newsletter: updates, guides, and product news.

3 responses

  1. Enzo Avatar

    Very solid read Alimir! I love how you stressed that 2FA isn’t just an extra step — it’s a strong barrier against hackers and brute‑force attacks. Definitely made me rethink my login security setup.

    1. Alimir Avatar

      Thanks a lot! 🙌 I’m glad it made you rethink login security. With WP ULike Pro, you can take it even further—adding advanced protections that make brute-force attacks practically impossible!

  2. Bo Avatar

    Clear and well-structured post. Learned something new today.

    Alimir

Leave a Reply

Your email address will not be published. Required fields are marked *