Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_set_password

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
2516      } else {
2517           $wpdb->insert( $wpdb->users, $data );
2518           $user_id = (int) $wpdb->insert_id;
2519      }
2520
2521      $user = new WP_User( $user_id );
2522
2523      if ( ! $update ) {
2524           /** This action is documented in wp-includes/pluggable.php */
2525           do_action( 'wp_set_password', $userdata['user_pass'], $user_id, $user );
2526      }
2527
2528      /**
2529       * Filters a user's meta values and keys immediately after the user is created or updated
2530       * and before any user meta is inserted or updated.
2531       *
2532       * Does not include contact methods. These are added using `wp_get_user_contact_methods( $user )`.
2533       *
2534       * For custom meta fields, see the {@see 'insert_custom_user_meta'} filter.
 
Line Code
2703      // Escape data pulled from DB.
2704      $user = add_magic_quotes( $user );
2705
2706      if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
2707           // If password is changing, hash it now.
2708           $plaintext_pass        = $userdata['user_pass'];
2709           $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );
2710
2711           /** This action is documented in wp-includes/pluggable.php */
2712           do_action( 'wp_set_password', $plaintext_pass, $user_id, $user_obj );
2713
2714           /**
2715            * Filters whether to send the password change email.
2716            *
2717            * @since 4.3.0
2718            *
2719            * @see wp_insert_user() For `$user` and `$userdata` fields.
2720            *
2721            * @param bool  $send     Whether to send the email.