Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_authenticate_user

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
189      /**
190       * Filters whether the given user can be authenticated with the provided password.
191       *
192       * @since 2.5.0
193       *
194       * @param WP_User|WP_Error $user     WP_User or WP_Error object if a previous
195       *                                   callback failed authentication.
196       * @param string           $password Password to check against the user.
197       */
198      $user = apply_filters( 'wp_authenticate_user', $user, $password );
199      if ( is_wp_error( $user ) ) {
200           return $user;
201      }
202
203      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
204           return new WP_Error(
205                'incorrect_password',
206                sprintf(
207                     /* translators: %s: User name. */
 
Line Code
260
261      if ( ! $user ) {
262           return new WP_Error(
263                'invalid_email',
264                __( 'Unknown email address. Check again or try your username.' )
265           );
266      }
267
268      /** This filter is documented in wp-includes/user.php */
269      $user = apply_filters( 'wp_authenticate_user', $user, $password );
270
271      if ( is_wp_error( $user ) ) {
272           return $user;
273      }
274
275      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
276           return new WP_Error(
277                'incorrect_password',
278                sprintf(