Skip to content
GPLWP Guides

How to add social login to a WordPress site

Security Time About 30–60 minutes for one provider 6 steps Updated 17 Nov 2026

SECURITY
The short answer

WordPress does not include social login in its standard login form, so you need an OAuth plugin or a custom integration. The practical route is to create an app with each provider, copy the plugin’s exact callback URL into that app, then test login with an account that is not an app administrator.

The route
  1. 01Choose providers and account rules
  2. 02Use a social login plugin
  3. 03Create each provider app
  4. 04Register the exact callback URL
  5. 05Configure and test the login
  6. 06Review security and privacy

What you need

  • A WordPress site using HTTPS
  • Administrator access to WordPress
  • A developer account with each social provider you plan to use
  • A privacy policy that explains the data shared with external login providers

Choose providers and account rules

Decide whether visitors should log in with Google, Facebook, X, LinkedIn or another provider. Start with one provider rather than enabling several at once, because each one has its own application dashboard, credentials and redirect rules.

Decide what happens when no WordPress account matches the provider email. You can allow a new account, require approval, or allow social login only for existing users. Do not automatically merge accounts unless the provider returns a verified email and your integration handles account linking safely.

Use a social login plugin

For most sites, install a maintained social login plugin from the WordPress admin area and activate it. A suitable plugin adds the provider buttons to the WordPress login and registration screens, then handles the OAuth request, callback and WordPress session. WordPress’s normal login form only handles username or email and password; it does not provide these provider connections by itself.

Open the plugin settings and enable only the providers you intend to support. Note the client ID, client secret and callback URL fields, but do not paste secrets into page content, theme files or public repositories.

Create each provider app

In the provider’s developer console, create a web application for your site and copy its client ID and client secret. The names vary by provider, but you will usually need to select a web platform, provide your site domain and enable the provider’s login product.

Use HTTPS on the live site. Google requires secure redirect URIs for web OAuth clients, with localhost treated as an exception for development. Facebook also requires the callback to be entered in its allowed redirect URI settings.

Register the exact callback URL

Copy the callback or redirect URL shown by the plugin and paste it into the provider app exactly as displayed. Keep the scheme, domain, path, port, query string and trailing slash consistent. Add separate entries for staging and production only when the provider and plugin support both.

This is where many Friday-night failures start. A site moved from http to https, changed from www to the root domain, or gained a new login-page path can produce a redirect URI mismatch even though the button still appears. Update the provider dashboard whenever the site URL or callback changes.

Configure and test the login

Enter the client ID and secret in the plugin, save the settings, and place the login buttons on the standard WordPress login and registration pages or your custom login form. If the site uses WooCommerce or a membership system, enable its login and registration placement separately where the plugin provides that option.

Test a first-time login, a returning login, account linking, logout and a cancelled or rejected authorisation. Test with an account that is not the provider app owner, administrator or developer. Development-mode provider apps often allow team accounts while blocking ordinary visitors, so an administrator-only test can give a false result.

Review security and privacy

Keep provider secrets private, update the plugin and WordPress regularly, and remove providers you no longer use. Check that the integration validates the OAuth state value, provider token or authorisation response, token audience and email verification before creating or linking a WordPress account. These checks help prevent login forgery and unsafe account matching.

Update your privacy notice to name the provider, explain what information is received, and state whether a new WordPress account is created. If you build the integration yourself, use a custom plugin or bespoke authentication service rather than placing the code in a theme that may later be replaced.

Fast way: install a maintained social login plugin, enable Google first, copy its exact callback URL into the Google app, enter the credentials, and test with a separate account. If the site uses Directorist, Directorist Social Login is the relevant shortcut because it is designed for Directorist directory sites and supports Facebook, Google, Twitter and LinkedIn.

The fast route

Let Directorist do it

Directorist-focused social login with Facebook, Google, Twitter, and LinkedIn; choose it for directory sites using Directorist.

Get Directorist

Sources

  1. developer.wordpress.org /reference/functions/wp_login_form/?utm_source=openai
  2. developers.google.com /identity/protocols/oauth2/web-server?utm_source=openai
  3. wordpress.org /plugins/webplatform-social-login/?utm_source=openai
  4. wordpress.org /support/topic/suggestion-add-features/?utm_source=openai

Questions

Can WordPress add social login without a plugin?
Yes, but only with a custom OAuth integration or a separate authentication service. You must build the provider redirect, callback handling, state protection, token validation, user lookup, account creation and login session logic yourself. That route is reasonable for a developer who needs special identity rules, but a plugin is safer and faster for a normal site because provider settings and APIs change over time.
Why does social login say the redirect URI is invalid?
The provider does not recognise the callback URL sent by WordPress. Copy the exact callback shown in your plugin settings and compare the protocol, domain, path, port, query string and trailing slash with the entry in the provider dashboard. HTTPS, www changes, staging domains and renamed login pages are common causes of this error.
Can social login create new WordPress users?
Usually, yes, if account creation is enabled and the provider supplies a verified email or another reliable identifier. The setting may also depend on whether WordPress registration is allowed. Decide how duplicate emails and existing accounts are handled before enabling it, because careless automatic matching can connect the wrong social identity to a WordPress user.
Why does it work for me but not for visitors?
Your provider app may still be in development mode, where only its owners, administrators, developers or testers can authenticate. Test with an unrelated account and check whether the provider requires app review, advanced access, business verification or a live-mode switch. Also confirm that the email permission and exact production callback are configured.