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
226
227      if ( ! $user ) {
228           return new WP_Error(
229                'invalid_email',
230                __( 'Unknown email address. Check again or try your username.' )
231           );
232      }
233
234      /** This filter is documented in wp-includes/user.php */
235      $user = apply_filters( 'wp_authenticate_user', $user, $password );
236
237      if ( is_wp_error( $user ) ) {
238           return $user;
239      }
240
241      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
242           return new WP_Error(
243                'incorrect_password',
244                sprintf(