admin管理员组

文章数量:1426295

I am following this tutorial and have entered in the code exactly as shown. The functions work but they are not displaying any information. When I use var_dump($user_id); I get this error:

object(WP_Error)#1021 (2) {  
   ["errors"]=> array(1) { 
      ["empty_user_login"]=> array(1) { 
          [0]=> string(46) "Cannot create a user with an empty login name." 
      } 
   } 
   ["error_data"]=> array(0) { } 
} 

but it is not empty. I have also tried to add it as the documentation states for wp_insert_user() here and I will populate but no information in the zip code. Any suggestions?

$user_id = wp_insert_user(
  array(
    'user_login'  => $input['testeroo'],
    'user_pass' => wp_generate_password ( 12, false ),
    'first_name'  => $input['first_name'],
    'last_name' => $input['last_name'],
    'user_email'  => $input['email_address'],
    'display_name'  => $input['first_name'] . ' ' . $input['last_name'],
    'nickname'  => $input['first_name'] . ' ' . $input['last_name'],
    'role'    => 'None'
  )
);
update_user_meta( $user_id, 'zip_code', $input['zip_code'] );
var_dump($user_id);

本文标签: phpHow To Add Custom User Meta During Registration