| 开发者 |
rtCamp
sh4lin nikhiljoshua mchirag2002 mi5t4n |
|---|---|
| 更新时间 | 2026年11月6日 19:41 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0.2 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
YOUR_DOMAIN/wp-login.php in Authorized redirect URIsWP Admin > Settings > WP Google Login, or in wp-config.php using the following code snippet:define( 'WP_GOOGLE_LOGIN_CLIENT_ID', 'YOUR_GOOGLE_CLIENT_ID' );
define( 'WP_GOOGLE_LOGIN_SECRET', 'YOUR_SECRET_KEY' );
Browser support
These browsers are supported. Note, for example, that One Tap Login is not supported in Safari.
How to enable automatic user registration
You can enable user registration either by
define( 'WP_GOOGLE_LOGIN_USER_REGISTRATION', 'true' );
in wp-config.php file.
Note: If the checkbox is ON then, it will register valid Google users even when WordPress default setting, under
Settings > General Settings > Membership > Anyone can register checkbox
is OFF.
Restrict user registration to one or more domain(s)
By default, when you enable user registration via constant WP_GOOGLE_LOGIN_USER_REGISTRATION or enable Settings > WP Google Login > Enable Google Login Registration, it will create a user for any Google login (including gmail.com users). If you are planning to use this plugin on a private, internal site, then you may like to restrict user registration to users under a single Google Suite organization. This configuration variable does that.
Add your domain name, without any schema prefix and www, as the value of WP_GOOGLE_LOGIN_WHITELIST_DOMAINS constant or in the settings Settings > WP Google Login > Whitelisted Domains. You can whitelist multiple domains. Please separate domains with commas. See the below example to know how to do it via constants:
define( 'WP_GOOGLE_LOGIN_WHITELIST_DOMAINS', 'example.com,sample.com' );
Note: By default, whitelisted domain restrictions apply to both registration and login for existing accounts. To allow existing users to log in with Google regardless of domain allowlist, use the rtcamp.google_enforce_whitelisted_domains_on_login filter and return false.
Hooks
For a list of all hooks please refer to this documentation.
wp-config.php parameters list
WP_GOOGLE_LOGIN_CLIENT_ID (string): Google client ID of your application.WP_GOOGLE_LOGIN_SECRET (string): Secret key of your applicationWP_GOOGLE_LOGIN_USER_REGISTRATION (boolean) (optional): Set true If you want to enable new user registration. By default, user registration defers to Settings > General Settings > Membership if constant is not set.WP_GOOGLE_LOGIN_WHITELIST_DOMAINS (string) (optional): Comma-separated list of allowed domains for login and registration. When configured, restricts authentication and account creation to matching email domains. By default, it will allow all domains. You can whitelist multiple domains.plugin-name.php to the /wp-content/plugins/ directoryBefore creating a new issue, do browse through the existing issues for resolution or upcoming fixes. If you still need to log an issue, making sure to include as much detail as you can, including clear steps to reproduce the issue, if possible.
Want to contribute a new feature? Start a conversation by logging an issue. Once you're ready to send a pull request, please run through the following checklist:
develop for each issue you'd like to address and commit your changes.develop and be in the pipeline for the next release. Props to you! 🎉composer install && composer tests:unit to run unit tests.Code snippets to extend and customize the plugin can be found here.
rtcamp.google_enforce_whitelisted_domains_on_login filter for backward compatibility.
Security: Bind Google OAuth sub to WordPress account on first verified login (TOFU).
Security: Use per-browser anti-CSRF state token with __Host- cookie boundary.
Security: Trigger standard WordPress authentication filters during One Tap login.
Security: Mask client secret in settings UI and add explicit option to clear stored secret.
1.4.4
Update: Updated Composer and NPM dependencies.
1.4.3
Security: Reject Google identities without a verified email address.
Update: Updated Composer and NPM dependencies.
1.4.2
Fix: Migrated rtcamp.google_redirect_url from action to filter.
Chore: Documentation update.
1.4.1
Fix: Resolved the issue of redirect_to parameters not working with the shortcode.
Update: Migrated block implementation to modern block implementations.
Update: Updated Composer and NPM dependencies.
Fix: Fixed the issue of One-tap script not being enqueued if the user was logged out.
Chore: Documentation update.
1.4.0
Update: Migrated One Tap Login to use FedCM.
Update: After a successful login or logout, users are now redirected to the page they originally intended to access.
Update: When the plugin performs a redirect, it now includes an x-redirect-by header.
Update: A settings page link has been added directly under the plugin name on the Plugins screen.
Fix: Resolved an issue with generating unique usernames.
Fix: Fixed a bug where JavaScript string translations were not being applied correctly.
Chore: Documentation update.
1.3.7
[google_login] with optional attributes: [google_login button_text="Login with Google" force_display="no" redirect_to="https://example.url/page"].