WordPress Filters Battle – authenticate vs wp_authenticate_user

WordPress provide developers with lots of Action and Filter hooks for modifying, changing and remove certain operation / functionality in its core.

These filters: authenticate and wp_authenticate_user are similar in that they can both be used to perform additional validation/authentication any time a user logs in to WordPress.

The difference between them is: the former is triggered before WordPress validate the login form while the latter is after WordPress has validated the login details but before user is signed.

Example: say you want to protect the login form from spam with a CAPTCHA; if you wish to validate / ensure the CAPTCHA challenged is passed before WordPress validate the user-supplied login details use authenticate but if you want it done after WordPress validation, use wp_authenticate_user.

Don’t miss out!
Subscribe to My Newsletter
Invalid email address