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