Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Add Login with Phone Number via OTP in WordPress

Remember when email and password were the only way to log into websites? Times have changed, and now many users expect the convenience of logging in with their phone numbers.

After helping different people set up phone-based login systems on their WordPress sites, I’ve learned which methods work best – and which ones to avoid. I’ve tested everything from premium plugins to custom solutions to find the most reliable options.

In this guide, I’ll share how to add phone number login with OTP verification to your WordPress site. Whether you’re running a small business site or a large membership platform, you’ll find a solution that fits your needs.

Add Login with Phone Number via OTP in WordPress

Why Let WordPress Users Log in With Their Phone Numbers?

Allowing users to log in through a one-time passcode (OTP) via phone number is a common practice. It removes the need to remember complex passwords while keeping their accounts secure.

Here is why you should consider adding phone login to your WordPress site:

  • Better Security: Unlike static passwords, OTPs expire after a single use, making logins significantly safer.
  • Faster Sign-Ins: No need to type in long passwords. A quick code sent to a phone lets users log in instantly.
  • Fewer Password Resets: If you’re running a community site, your users no longer have to reset forgotten passwords, saving you time and support tickets.
  • Improved User Experience: A smooth login keeps people happy and more likely to return to your site.
  • Ideal for Mobile Users: More people browse on their phones. Letting them log in with a code makes the process seamless.

Now, let’s take a look at how to easily allow login with phone number via OTP in WordPress.

How to Add Login with Phone Number via OTP in WordPress

You can easily add a phone number login to WordPress using the free Login with Phone Number plugin.

However, since WordPress does not send SMS messages by default, you will also need a third-party service like Firebase or Twilio to handle OTP delivery.

First, you need to install and activate the free Login With Phone Number plugin. For details, see this tutorial on how to install a WordPress plugin.

Upon plugin activation, visit the Login Settings » General page from the WordPress dashboard and check the ‘Enable phone number login’ option.

After that, you can add country codes for all the regions where your users are logging in. By default, the plugin includes the phone number country codes for all countries.

I recommend leaving this setting as it is. It ensures that your site remains accessible to a global audience.

Enable phone login

Next, you need to check the ‘Enable email login’ option if you want to allow email login for your users.

I recommend this setting if you have existing users who are used to logging in with their email. By doing so, you’ll ensure that they won’t get frustrated once phone number login is enabled, as they’ll still be able to log in using their email.

You can then check the ‘Force to get email after phone number’ option. This setting ensures that new users are required to provide their email address before they can complete registration. It’s especially useful if you already have an email list and want to collect emails from new users.

You can also enable user registration with a phone number. Once that is done, type the length of the activation code that will be given to users.

Choose activation code length

After that, you have to scroll down and find the ‘Enable Timer’ option. Click to enable it, then set the time limit for users to enter the OTP.

For example, if you set it to 60 seconds, users will have one minute to enter their code before it expires. Then, click the ‘Save Changes’ button to store your settings.

Enable timer

Go ahead and switch to the ‘Gateway’ tab from the top. Here, you must select an SMS service provider for your phone number OTP login.

I will be choosing Firebase for this tutorial. It’s a Google service that lets you send one-time passcodes to users’ phones for secure login.

It’s a good idea to check their pricing page for the latest details. However, you can also choose options like Twilio, WhatsApp, Alibaba SMS, and more.

Keep in mind that some of the options will only be available in the Pro plan.

Choose an SMS gateway

Once you choose Firebase, you will need to add its API key and config.

For this, you need to visit the Firebase Console and select the ‘Create a Firebase Project’ option.

Create a firebase project

This will take you to a new screen, where you must add a project name. You can call it anything that helps you remember what you’re using it for.

Then, click the ‘Continue’ button.

Add a name for your project

Firebase will now ask permission to enable Google Analytics for the project.

Once you have allowed that, you must select ‘Default Account for Firebase’ from the dropdown menu and click the ‘Create Project’ button.

Click the Create Project button

You will now be taken to the Project Overview page. Here, navigate to the Build » Authentication tab from the left column.

Go ahead and click the ‘Get started’ button.

Click Get Started on the Authentication page

Once you do that, some new settings will become visible on the screen. From here, find ‘Phone’ in the list of sign-in providers, click on it, and then toggle the ‘Enable’ switch.

This will allow users to sign in with a mobile phone number using Firebase SDK phone verification. Then, click the ‘Save’ button.

Enable the phone option in Firebase

Now, switch to the ‘Settings’ tab and select the ‘Authorized domains’ option from the left column. Here, you have to click the ‘Add domain’ button.

This will open a prompt where you need to add your website’s domain name.

This is an important security measure that ensures only your website is permitted to connect to this Firebase project, preventing unauthorized use by others.

Click Add Domain button

After that, just click the settings icon next to Project Overview at the top and select the ‘Project Settings’ tab.

Then, scroll down to the ‘Your Apps’ section and select the web icon.

Click the web icon

You will now need to add a name for your app and click the ‘Register App’ button. When you do that, Firebase will generate a special configuration code for its SDK.

‘SDK’ stands for Software Development Kit, and this code contains all the necessary settings to connect your WordPress site to your Firebase project.

Click the Register App button

From here, simply click the ‘Continue to Console’ button.

Once you are back on the Project Overview page, simply copy the ‘Web API Key’ and store it somewhere safe.

Copy the web API key for Firebase

Now, scroll down to the ‘Your Apps’ section where details for your newest app will be displayed on the screen.

Here, choose the ‘Config’ radio button to display your Firebase SDK as config. Simply copy and store it somewhere safe.

Copy the Firebase SDK config

After that, you need to head back to your WordPress dashboard and add the Firebase API key and config into their respective fields in the Login with Phone Number plugin settings.

Next, click the ‘Save Changes’ button to store your settings.

Add Firebase API key and  config

Once that is done, open the WordPress page where you want to add the login form and click the ‘Add Block’ button.

From the block menu, you need to choose the ‘Shortcode’ block and add the following shortcode into it:

[idehweb_lwp]

Add phone number login shortcode

Finally, click the ‘Update’ or ‘Publish’ button to store your settings.

Now, when new users visit your website, they will be able to register and log in using their phone number, while existing users can still log in with their email.

Phone number login via OTP

Once you’ve set this up, I recommend sending an email to your existing users, encouraging them to add their phone numbers as soon as possible.

They can do this by visiting their profile page in the WordPress dashboard, scrolling down to the ‘Personal Information’ section, adding their phone number, and clicking Update User.

This ensures that even existing users who have signed up already can log in with their phone numbers later on.

Existing users adding phone numbers

Bonus: Add One-Click Login With Google in WordPress

While logging in with a phone number and OTP is a secure option, some users prefer an even quicker way to access their accounts.

Adding Google one-click login allows users to sign in instantly, which can improve the user experience, reduce login friction, and increase signups.

It is especially useful for sites with frequent visitors, such as membership platforms, online stores, or communities.

Google Login Preview

You can easily add this feature using the Nextend Social Login plugin. It is a popular tool that allows users to register and log in to your site using their existing social media accounts like Google, Facebook, and Twitter.

It also allows you to link social profiles to existing accounts, so returning users do not create duplicates.

Adding social login to your WordPress website

To get started, just see our tutorial on how to add one-click login with Google in WordPress.

Frequently Asked Questions About Adding Login with Phone Number via OTP in WordPress

Setting up a new login system can bring up a few questions. Here are the answers to some of the most common ones I get asked about adding phone number login to WordPress.

What happens if my site exceeds the free limits on Firebase?

If your website’s traffic grows and you exceed the free usage tier for a service like Firebase, you would then move to their paid plan.

It’s a good idea to monitor your usage in your Firebase account dashboard.

Can my existing users still log in with their old email and password?

Yes. As shown in the tutorial, the Login with Phone Number plugin allows you to keep email login enabled. This is highly recommended to avoid confusing your existing users.

They can continue to log in with their old credentials and can choose to add their phone number to their profile at any time.

Is it possible to customize the design of the phone login form?

The free version of the plugin offers basic styling that is designed to blend in with most WordPress themes.

The pro version of the plugin also includes more built-in styling options.

Will this phone login method work with WooCommerce or my membership plugin?

Yes, the Login with Phone Number plugin is designed to integrate with the standard WordPress login and registration hooks.

This means it should automatically work with popular plugins like WooCommerce, MemberPress, and others that use the default WordPress user system for their login and registration pages.

I hope this article helped you learn how to add login with phone number via OTP in WordPress. You may also want to see our beginner’s guide on how to remove the password reset/change option from WordPress and our tutorial on creating a WordPress login popup modal.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

Comments

  1. Congratulations, you have the opportunity to be the first commenter on this article.
    Have a question or suggestion? Please leave a comment to start the discussion.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.