title: wordpress wp_insert_user function
body: <p>I am in the process of creating a custom registration form for WordPress. <br />My problem is adding custom user meta. I believe the function <code>wp_insert_user</code> will only allow you to add the default fields within the WordPress user table.</p>
  
  <p>Here is my current test code:</p>
  
  <pre><code>$username = '12344';
  $password = '1111';
  $user_data = array(
  'ID' =&gt; '',
  'user_pass' =&gt; $password,
  'user_login' =&gt; $username,
  'display_name' =&gt; $loginName,
  'first_name' =&gt; $firstName,
  'last_name' =&gt; $lastName,
  'role' =&gt; get_option('default_role') ,
  'user_secondry_email' =&gt; 'test@tst.com'// Use default role or another role, e.g. 'editor'
  );
  $user_id = wp_insert_user( $user_data );
  wp_hash_password( $password );
  </code></pre>
  
  <p>I have found the <code>add_user_meta</code> function, but this requires an ID to add the metadata. Obviously the user hasn't been created yet so they won't have an ID. Any ideas on how to get around this?</p>
  
  <p>Thanks, Dan</p>