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
159      /**
160       * Filters whether the given user can be authenticated with the provided $password.
161       *
162       * @since 2.5.0
163       *
164       * @param WP_User|WP_Error $user     WP_User or WP_Error object if a previous
165       *                                   callback failed authentication.
166       * @param string           $password Password to check against the user.
167       */
168      $user = apply_filters( 'wp_authenticate_user', $user, $password );
169      if ( is_wp_error( $user ) ) {
170           return $user;
171      }
172
173      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
174           return new WP_Error(
175                'incorrect_password',
176                sprintf(
177                     /* translators: %s: user name */
 
Line Code
232                'invalid_email',
233                __( '<strong>ERROR</strong>: Invalid email address.' ) .
234                ' <a href="' . wp_lostpassword_url() . '">' .
235                __( 'Lost your password?' ) .
236                '</a>'
237           );
238      }
239
240      /** This filter is documented in wp-includes/user.php */
241      $user = apply_filters( 'wp_authenticate_user', $user, $password );
242
243      if ( is_wp_error( $user ) ) {
244           return $user;
245      }
246
247      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
248           return new WP_Error(
249                'incorrect_password',
250                sprintf(