php - How To Add Custom User Meta During Registration

I am following this tutorial and have entered in the code exactly as shown. The functions work but they are not displayi

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);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745446004a4628049.html

相关推荐

  • php - How To Add Custom User Meta During Registration

    I am following this tutorial and have entered in the code exactly as shown. The functions work but they are not displayi

    12小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信