WordPress filter hook · part of WordPress core

authenticate

A WordPress core filter that 34 plugins also fire themselves, running on 2.4M+ sites between them.

“Filter user authentication before setting auth cookies. Allows multisite spam-user checks and lockout plugins hooked to 'authenticate' to run.”

How to use authenticate

It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'authenticate', function( $value, $username, $password ) {
	// Change $value here.
	return $value;
}, 10, 3 );

Argument names come from miniOrange 2FA's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

34 plugins that fire authenticate

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Limit Login Attempts Security icon Limit Login Attempts Security1+ million installs apply_filters( 'authenticate', null, $log, $pwd ) core/integrations/MemberPressIntegration.php:257
  2. Loginizer icon Loginizer1+ million installs do_action( 'authenticate', $user, $user->user_login, '' ) main/social-base.php:23
  3. Ultimate Member icon Ultimate Member200,000+ installs apply_filters( 'authenticate', null, $authenticate, $submitted_data['user_password'] ) includes/core/um-actions-login.php:64
  4. Nextend Social Login and Register icon Nextend Social Login and Register200,000+ installs apply_filters( 'authenticate', $user, $user->get('user_login'), '' ) includes/user.php:559
  5. miniOrange 2FA icon miniOrange 2FA10,000+ installs apply_filters( 'authenticate', null, $username, $password ) controllers/class-wpns-ajax.php:148
  6. Security Ninja icon Security Ninja7,000+ installs apply_filters( 'authenticate', null, $username, $password ) class-wf-sn-tests.php:2053
  7. Log in with Google icon Log in with Google6,000+ installs apply_filters( 'authenticate', $wp_user, $wp_user->user_login, '' ) src/Modules/OneTapLogin.php:272
  8. bbp style pack icon bbp style pack6,000+ installs apply_filters( 'authenticate', null, $username, $password ) bbp-style-pack.php:333
  9. Plugin Detective icon Plugin Detective5,000+ installs apply_filters( 'authenticate', null, $username, $password ) troubleshoot/includes/class-auth.php:64
  10. BetterShield icon BetterShield1,000+ installs apply_filters( 'authenticate', $user, $user->user_login, '' ) src/TwoFactor/Manager.php:760
  11. Login with Vipps and MobilePay icon Login with Vipps and MobilePay900+ installs apply_filters( 'authenticate', $user, '', '' ) VippsLogin.class.php:1105
  12. Sidebar Login Widget icon Sidebar Login Widget600+ installs apply_filters( 'authenticate', null, $username, $password ) tt-sidebar-login.php:316
  13. Mythic Cerberus icon Mythic Cerberus200+ installs apply_filters( 'authenticate', null, $username, $password ) mythic-cerberus.php:476
  14. User Registration & Login icon User Registration & Login50+ installs apply_filters( 'authenticate', $user, $user->user_login, '' ) includes/class-sav-frontend.php:3832
  15. Advanced Members for ACF icon Advanced Members for ACF20+ installs apply_filters( 'authenticate', null, $user_name, $user_password ) core/actions/login.php:172
  16. PostGate icon PostGate20+ installs apply_filters( 'authenticate', $user, $user->user_login, '' ) includes/auth/class-google-auth-handler.php:365
  17. WP Smart Security icon WP Smart Security20+ installs apply_filters( 'authenticate', null, $username, $password ) inc/auth.php:32
  18. CM Registration icon CM Registration20+ installs apply_filters( 'authenticate', null, $login, $password ) model/User.php:123
  19. HonnyPotter icon HonnyPotter10+ installs apply_filters( 'authenticate', null, $username, $password ) honnypotter.php:71
  20. VA Simple Enhanced Security icon VA Simple Enhanced Security10+ installs apply_filters( 'authenticate', null, $username, $password ) incs/class-module-email-login.php:164
  21. Secure Login icon Secure Login10+ installs apply_filters( 'authenticate', null, $username, $password ) includes/authenticate.php:24
  22. asVereinbase icon asVereinbase10+ installs apply_filters( 'authenticate', null, $username, $password ) public/user-login.php:458
  23. Login Token icon Login Token10+ installs apply_filters( 'authenticate', null, $username, $password ) index.php:25
  24. Anar Toolkit icon Anar Toolkit10+ installs apply_filters( 'authenticate', $checked, $user->user_login, '' ) src/Auth/UserService.php:358
  25. Logliy icon Logliy10+ installs apply_filters( 'authenticate', $user, $user->user_login, '' ) logliy.php:162
  26. Real Protection & Safegaurd OTP icon Real Protection & Safegaurd OTPFewer than 10 installs apply_filters( 'authenticate', null, $username, $password ) lib/safeguard-authenticate.php:30
  27. Pnscode Social Login and Register icon Pnscode Social Login and RegisterFewer than 10 installs apply_filters( 'authenticate', $user_obj, $user_obj->user_login, '' ) includes/class-pnscsolo-email-verification.php:125
  28. Vokull Security Center icon Vokull Security CenterFewer than 10 installs apply_filters( 'authenticate', $user, (string) $user->user_login, '' ) includes/auth/class-two-factor-login.php:413
  29. Qevix Shield icon Qevix ShieldFewer than 10 installs apply_filters( 'authenticate', null, '', '' ) includes/auth/class-qevix-shield-2fa.php:773
  30. LinxyPass icon LinxyPassFewer than 10 installs apply_filters( 'authenticate', $user, $user->user_login, '' ) includes/class-assets.php:91
  31. Kudzu Social Login icon Kudzu Social LoginFewer than 10 installs apply_filters( 'authenticate', $user, $user->user_login, '' ) includes/class-oauth.php:197
  32. atshift Members icon atshift MembersFewer than 10 installs apply_filters( 'authenticate', get_userdata($result['user_id']), '', '' ) includes/class-screens.php:100
  33. atshift Freeform Login icon atshift Freeform LoginFewer than 10 installs apply_filters( 'authenticate', $user, $user->user_login, '' ) includes/passkeys/class-atshift-freeform-login-passkey-rest.php:418
  34. Keyless Login icon Keyless LoginFewer than 10 installs apply_filters( 'authenticate', $user, $user_data->user_login, '' ) includes/class-keylesswp-passkeys.php:339
  35. WP Passport icon WP PassportFewer than 10 installs apply_filters( 'authenticate', null, $username, $password ) wp-session.php:48

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.