title: Cannot set user password in wordpress
body: <p>i have tried everything i could find to set the user password on registration, but no success... I have the fields showing up, the verification(if the passwords match etc) i print them on screen, i print the userid on screen so every argument needed is there, but the function doesn't seem to work at all...
  This doesn't work...</p>
  
  <pre><code>$newpassword = "zzzzzz";
  
  update_user_meta($user_id, 'user_pass', $newpassword);
  </code></pre>
  
  <p>This doesn't work either...</p>
  
  <pre><code>add_action( 'user_register', 'ts_register_extra_fields', 10 );
  function ts_register_extra_fields($user_id, $password='11',$meta = array()){
      $userdata = array();
        if ( $_POST['password'] !== '' ) {
         $userdata['user_pass'] = $_POST['password'];
      }
      $new_user_id = wp_update_user( $userdata );
    }
  </code></pre>
  
  <p>My customer needs this for tomorrow, so I'm totally lost by now, i have no clue on why it's not working...</p>
  
  <p>Forgot to add, all this code is added in the functions.php of my theme. (It gets into it as i already said that i post the variables on screen).</p>
  
  <pre><code>add_action( 'user_register', 'ts_register_extra_fields', 100 );
  
  function ts_register_extra_fields( $user_id, $password = '', $meta = array() ) {
  
      $userdata = array();
  
      $userdata['ID'] = $user_id;
  
      $userdata['contacto'] = $_POST['contacto'];
  
      $userdata['nif'] = $_POST['nif'];
  
       if ( $_POST['password'] !== '' ) {
           $userdata['user_pass'] = $_POST['password'];
           echo "im in";
       }
       $new_user_id = wp_insert_user( $userdata );
  
       echo "id-".$userdata['ID'];
  
       echo "contacto-".$userdata['contacto'];
  
       echo "nif-".$userdata['nif'];
  
       echo "pass-".$userdata['user_pass'];
  }
  </code></pre>
  
  <p>All those echos output the correct data... for example id = 195 the next time i try 196 etc...
  contacto and nif show the data that i input in the custom registration field and the pass also shows the data that i had inputed in the custom registration field password...</p>