Resources     Blog  

  1. Home
  2. WordPress Tutorials
  3. How to Add Facebook Login for WordPress

How to Add Facebook Login for WordPress

Do you love using social media websites like Facebook and want to add a Facebook login button to your website? If so, then you are not alone! Facebook is the largest social media platform and plenty of websites are making sure their website is compatible with all of the latest features this social media juggernaut has to offer.

One of the best features that many websites have adopted is the ability to log in using Facebook. When you allow your site visitors to log in this way, they can skip the sign-up form on a website and sign up by linking their Facebook account.

This will save your visitors a lot of time and you can encourage them to follow you on Facebook at the same time. There are a few different ways to add a Facebook login button to WordPress. You can use custom coding and combine that with the Facebook developer API platform and build your own.

Or, you can go the route of a WordPress plugin.

Today we are going to explore a plugin together. This is the fastest and easiest way to add a Facebook login button to your website and allow your site users to login using that particular social media platform.

Why Add Facebook Login for WordPress?

The main purpose is to speed up the sign-up process for creating an account on your website, but there is a more important reason. When you look at social media platforms as a web developer, you should be seeing them as platforms to grow your website on.

By getting visitors to log onto Facebook through your website you can lead them to follow you and leave a like on your Facebook page. This is important because everyone on their friend’s list will be able to see that they liked your website.

This is where large social media websites like Facebook really start to shine. All of those friends will now be able to view your Facebook page. And if they leave a like, then all of their friends will be able to see and the cycle continues.

Simply put, the login button is a simple way to trigger the Facebook login process on your website or web app. This allows you to track visitors and reach out to them easier, and it allows users to quickly and easily login.

I have a found a powerful, yet simple to use plugin for this very thing. Let’s take a look at it and then get it set up together.

Login for WordPress

Facebook Login button Plugin

The Login for WordPress plugin is simple to use and straight to the point. If you want to add a Facebook login button to the wp-login.php to login/register users, then this plugin will give you exactly that.

It is a free plugin and very easy to use.

Note: The plugin also has a paid (pro) version that extends some functionality. However, this tutorial is based on the free plugin. This will provide you everything you need to properly set up a Facebook login button for WordPress.

This plugin is very developer-friendly as well because it is pretty easy to expand if needed or wanted. The plugin also gives you the ability to use certain shortcodes and PHP functions if you need to add the login button in other places besides the default wp-login.php page. We will go over those in the next section.

Let’s take a look at how to get the plugin installed and then see what it takes to set it up and get it running on your website.

Install and Activate the Plugin

In order to add a Facebook login button to your WordPress website, you first need to install and activate the plugin from above. You can do this by going to the Plugins page of your WordPress admin dashboard. Simply search the plugin name and install it right from there.

Install and activate plugin to add a facebook login button to wordpress

Once the plugin has been installed and activated, you want to access the main settings and configuration page. To do this click on Settings > Facebook Login. You will find this is the left side menu area of your admin dashboard.

Click settings then lcick faebook login

This will take you to the main setup page where you can easily get the plugin set up and going.

How to Add Facebook Login to WordPress

At this point, you should be on the configuration page for the plugin. You see that it is only one page, and that the process is very quick.

Facebook login settings page

Basically, to get the Facebook login button to automatically show on your website’s wp-login.php page, you need to go get a Facebook App ID and grab the App Secret Key from that ID.

If you already have some Facebook-related features like Facebook Events, Facebook Like Box, Facebook Posts, or any others, then you already have the app information you will need and can use it on this plugin.

If not, don’t worry, it’s quite easy to set up a Facebook app. Let’s open up the Facebook Developers website and sign up. Once you have signed up click on the “Add a New App” option.

click on the "Add a New App" option.

A pop-up will appear and ask you to name this new app. Call it something you can easily identify and click on the “Create App ID” button to continue.

When the page loads you should see the information you need, which includes the App ID and App Secret. Write down this information because you can use it every time you want to use a Facebook-related plugin for WordPress.

Copy the App ID and the App Secret

Back on WordPress, insert the App ID and App Secret into the appropriate boxes on the plugin’s settings page. Once it is inserted, click on the “Save Changes” button to apply it.

Congratulations, visitors can now log in to your website by using their Facebook account. This allows them to skip those pesky login menus. Make sure to take advantage of them logging into Facebook by putting friendly reminders to visit and like your website’s Facebook page.

Other Facebook Login Button Commands

As I mentioned above, the plugin also gives you the ability to use a shortcode and some other PHP functions to add certain extras to your website. Here is the shortcode and the commands if you are interested in using any of them.

If you want to add a Facebook login button to any page on your website, use the following shortcode:

[fbl_login_button redirect=”” hide_if_logged=”” size=”large” type=”continue_with” show_face=”true”]

Add the following code lines to the functions.php file in your website if you chose to use these. Add them to the end of the file and click the “Update File” button to apply the changes.

If you want to add a Facebook login in your template or link a Facebook account to an existing profile, use the following code:

`<?php do_action('facebook_login_button');?>```

If you want to show a disconnect button to remove a Facebook connection from a user profile and avatar, then use this code:

`<?php do_action('facebook_disconnect_button');?>```

Finally, if you want to change the redirect URL after a user is logged in wp-login.php you can pass ?redirect_to= in the URL or use the following filter:

`add_filter('flp/redirect_url', function($url){ return site_url('another-url')});``

Use Other Facebook Features on Your Website

Facebook is extremely popular and has a lot of development support that you can take advantage of on your website. The most important part is to make sure that the website does not feel like an extension of Facebook.

There are so many features available that you could really add to your website, but you should only take the time to add the ones you need or your visitors are requesting. Keep in mind that the App ID and App Secret can be used multiple times for the various features that require them.

Final Thoughts

Facebook may be the largest social media platform, but it is not the only one. Twitter and Instagram are also huge social media platforms that have their own unique systems and can help your website grow.

For example, Instagram has a smaller user base than Facebook, but companies have noted they get more visitor interactions with their posts than other platforms. Depending on the nature of your website and the services you provide, this may suit your website better than Facebook.

Regardless of which platform you use, you need to keep in mind that just because you use Facebook does not mean you cannot use Twitter or Instagram as well. Building a social media following is not an easy task, and focusing on one platform is not enough. Remember, as long as you make your social media pages fun and enjoyable, they will grow.

Do your visitors like logging in with their Facebook account instead of the normal way? Have you noticed any growth to your Facebook page after introducing this sign-in method?

Author: Chris Racicot

Chris is the Support Manager at GreenGeeks and has been with the company since 2010. He has a passion for gaming, scripting and WordPress. When he’s not enjoying his sleep, he’s working on his guitar skills and fiddling with 3d printing.

Was this article helpful?

Related Articles

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.