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
156      /**
157       * Filters whether the given user can be authenticated with the provided $password.
158       *
159       * @since 2.5.0
160       *
161       * @param WP_User|WP_Error $user     WP_User or WP_Error object if a previous
162       *                                   callback failed authentication.
163       * @param string           $password Password to check against the user.
164       */
165      $user = apply_filters( 'wp_authenticate_user', $user, $password );
166      if ( is_wp_error( $user ) ) {
167           return $user;
168      }
169
170      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
171           return new WP_Error(
172                'incorrect_password',
173                sprintf(
174                     /* translators: %s: User name. */
 
Line Code
227
228      if ( ! $user ) {
229           return new WP_Error(
230                'invalid_email',
231                __( 'Unknown email address. Check again or try your username.' )
232           );
233      }
234
235      /** This filter is documented in wp-includes/user.php */
236      $user = apply_filters( 'wp_authenticate_user', $user, $password );
237
238      if ( is_wp_error( $user ) ) {
239           return $user;
240      }
241
242      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
243           return new WP_Error(
244                'incorrect_password',
245                sprintf(