title: Added custom field to user registration but field does not push information to the database
body: <p>Unfortunately I have been trying to figure out what is wrong with my code all day. I'm new to php so please forgive me if the answer is obvious. Also, if more information is needed, let me know.</p>
  
  <p>The following code is the registration page template for the Wordpress website I am creating. The goal was to add a custom phone number field to the form and have the number sent to the database. First, I created a new column in phpmyadmin called user_phone. Then I attempted to add the field to the code. Currently, once the new user fills out all of the info needed and hits submit, the user is redirected to the correct page and everything seems to go well. However, when I browse the users in phpmyadmin the phone number entered does not show up. Any help is appreciated!</p>
  
  <pre><code>&lt;?php
  /**
   * Template name: Register Page
   *
   * Learn more: http://codex.wordpress.org/Template_Hierarchy
   *
   * @package WordPress
   * @subpackage classiads
   * @since classiads 1.2.2
   */
  
  if ( is_user_logged_in() ) { 
  
      global $redux_demo; 
      $profile = $redux_demo['profile'];
      wp_redirect( $profile ); exit;
  
  }
  
  global $user_ID, $user_identity, $user_level, $registerSuccess;
  
  $registerSuccess = "";
  
  
  if (!$user_ID) {
  
      if($_POST) 
  
      {
  
          $message = "Registration successful.";
  
          $username = $wpdb-&gt;escape($_POST['username']);
  
          $email = $wpdb-&gt;escape($_POST['email']);
          /* PHONE NUMBER */
          $phone = $wpdb-&gt;escape($_POST['phone']);
  
          $password = $wpdb-&gt;escape($_POST['pwd']);
  
          $confirm_password = $wpdb-&gt;escape($_POST['confirm']);
  
          $registerSuccess = 1;
  
          $status = wp_create_user( $username, $password, $email );   
              if(empty($username)) {
                  $message = "User name should not be empty.";
                  $registerSuccess = 0;
              }elseif(empty($phone)) {
                  $message = "Phone number should not be empty.";
              }
              elseif(isset($password) || isset($email)) {                     
                  if (strlen($password) &lt; 5 || strlen($password) &gt; 15) {
  
                  $message = "Password must be 5 to 15 characters in length.";
  
                  $registerSuccess = 0;
  
                  }
  
                  //elseif( $password == $confirm_password ) {
  
                  elseif(isset($password) &amp;&amp; $password != $confirm_password) {
  
                      $message = "Password Mismatch";
  
                      $registerSuccess = 0;
  
                  }elseif(!filter_var($email, FILTER_VALIDATE_EMAIL))
                    {
                    $message = "Please enter a valid email.";
                    $registerSuccess = 0;              
                    } 
  
              }elseif(isset($email)) {
                  if(!filter_var($email, FILTER_VALIDATE_EMAIL))
                    {
                    $message = "Please enter a valid email.";
                    $registerSuccess = 0;              
                    } 
              }elseif ( is_wp_error($status) ) {
                  $registerSuccess = 0;
                  $message = "Username or E-mail already exists. Please try another one.";
              }
               else {
                  if($registerSuccess = 1){
                  $from = get_option('admin_email');
                  $headers = 'From: '.$from . "\r\n";
                  $subject = "Registration successful";
                  $msg = "Registration successful.\nYour login details\nUsername: $username\nPassword: $password";
                  wp_mail( $email, $subject, $msg, $headers );
  
                  $registerSuccess = 1;
                  }
              }
  
  
          if($registerSuccess == 1) {
              $login_data = array();
              $login_data['user_login'] = $username;
              $login_data['user_password'] = $password;
              $user_verify = wp_signon( $login_data, false ); 
  
              global $redux_demo; 
              $profile = $redux_demo['profile'];
              wp_redirect( $profile ); exit;
  
          }
  
  
  
      }
  
  }
  
  get_header(); ?&gt;
  
      &lt;div class="ad-title"&gt;
  
                  &lt;h2&gt;&lt;?php the_title(); ?&gt; &lt;/h2&gt;     
      &lt;/div&gt;
  
      &lt;section class="ads-main-page"&gt;
  
          &lt;div class="container"&gt;
              &lt;div class="log-in-logo"&gt;
                  &lt;a class="logo" href="&lt;?php echo home_url(); ?&gt;" title="Home"&gt;
                      &lt;?php global $redux_demo; $logo = $redux_demo['logo']['url']; if (!empty($logo)) { ?&gt;
                          &lt;img src="&lt;?php echo $logo; ?&gt;" alt="Logo" /&gt;
                      &lt;?php } else { ?&gt;
                          &lt;img src="&lt;?php echo get_template_directory_uri(); ?&gt;/images/logo.png" alt="Logo" /&gt;
                      &lt;?php } ?&gt;
                  &lt;/a&gt;                
              &lt;/div&gt;
              &lt;div class="first clearfix log-in"&gt;
  
                  &lt;h2 class="login-title"&gt;REGISTER&lt;/h2&gt; 
                  &lt;?php                   
                      if(get_option('users_can_register')) { //Check whether user registration is enabled by the administrator
                  ?&gt;
  
                  &lt;div id="edit-profile" class="clearfix" &gt;
  
                      &lt;div class="span4"&gt;
                          &lt;form class="form-item login-form" action="" id="primaryPostForm" method="POST" enctype="multipart/form-data"&gt;
  
                                  &lt;?php if($_POST) { 
  
                                      global $redux_demo; 
                                      $login = $redux_demo['login'];
  
                                      echo "&lt;div id='result' style='margin-bottom: 30px;'&gt;&lt;div class='message'&gt;&lt;h4&gt;".$message." ";
  
                                      if($registerSuccess == 1) {
                                          echo "&lt;a href='".$login."'&gt;Login&lt;/a&gt;.";
                                      }
  
                                      echo "&lt;/h4&gt;&lt;/div&gt;&lt;/div&gt;";
  
                                  } ?&gt;
  
                                      &lt;?php if($registerSuccess == 1) { } else { ?&gt;
  
  
  
  
                                          &lt;input id="contactName" placeholder="User Name" type="text" name="username" class="text input-textarea half" value="" maxlength="30" /&gt;
  
                                          &lt;input id="phone" placeholder="Phone Number" type="text" name="phone" class="text input-textarea half" value="" maxlength="30" /&gt;
  
  
                                          &lt;input id="email" placeholder="Email Address" type="text" name="email" class="text input-textarea half" value=""  maxlength="30" /&gt;
  
  
                                          &lt;input id="password" placeholder="Password" type="password" name="pwd" class="text input-textarea half" maxlength="15"  value="" /&gt;
  
  
                                          &lt;input id="password" placeholder="Retype Password" type="password" name="confirm" class="text input-textarea half" maxlength="15" value="" /&gt;
  
  
  
                                      &lt;br/&gt;
  
  
                                          &lt;input type="hidden" name="submit" value="Register" id="submit" /&gt;
                                          &lt;div class="clearfix"&gt;&lt;/div&gt;
                                          &lt;div class="btn-container"&gt; 
                                              &lt;button class="btn form-submit" id="edit-submit" name="op" value="Publish Ad" type="submit"&gt;&lt;?php _e('Submit', 'agrg') ?&gt;&lt;/button&gt;
                                          &lt;/div&gt;
  
  
                                  &lt;?php } ?&gt;
  
                          &lt;/form&gt;
  
  
                          &lt;div class="clearfix"&gt;&lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="span4 last"&gt;
                      &lt;span&gt;Already have an acount ?&lt;/span&gt; &lt;a class="login-a" href=""&gt;Login Now&lt;/a&gt;
  
  
  
  
                          &lt;div class="publish-ad-button login-page"&gt;
  
                              &lt;?php
  
                                  global $redux_demo; 
                                  $login = $redux_demo['login'];
                                  $reset = $redux_demo['reset'];
  
                              ?&gt;
  
  
  
                          &lt;/div&gt;
  
                      &lt;/div&gt;
  
                  &lt;/div&gt;
  
                  &lt;?php }
  
                      else echo "&lt;span class='registration-closed'&gt;Registration is currently disabled. Please try again later.&lt;/span&gt;";
  
                  ?&gt;
  
              &lt;/div&gt;
  
  
  
  
  
          &lt;/div&gt;
  
      &lt;/section&gt;
  
  &lt;?php get_footer(); ?&gt;
  </code></pre>
  
  <p>EDIT 1: I changed wp_create_user to wp_insert_user and called in all of the fields. However, the phone number is still not being pushed to the database. </p>
  
  <pre><code>&lt;?php
  /**
   * Template name: Register Page
   *
   * Learn more: http://codex.wordpress.org/Template_Hierarchy
   *
   * @package WordPress
   * @subpackage classiads
   * @since classiads 1.2.2
   */
  
  if ( is_user_logged_in() ) { 
  
      global $redux_demo; 
      $profile = $redux_demo['profile'];
      wp_redirect( $profile ); exit;
  
  }
  
  global $user_ID, $user_identity, $user_level, $registerSuccess;
  
  $registerSuccess = "";
  
  
  if (!$user_ID) {
  
      if($_POST) 
  
      {
  
          $message = "Registration successful.";
  
          $username = $wpdb-&gt;escape($_POST['username']);
  
          $email = $wpdb-&gt;escape($_POST['email']);
          /* PHONE NUMBER */
          $phone = $wpdb-&gt;escape($_POST['phone']);
  
          $password = $wpdb-&gt;escape($_POST['pwd']);
  
          $confirm_password = $wpdb-&gt;escape($_POST['confirm']);
  
          $registerSuccess = 1;
  
          $userdata = array(
              'user_login'    =&gt;  $username,
              'user_email'    =&gt;  $email,
              'user_phone'    =&gt;  $phone,
              'user_pass'    =&gt;  $password,
          );
  
          $status = wp_insert_user( $userdata );  
              if(empty($username)) {
                  $message = "User name should not be empty.";
                  $registerSuccess = 0;
              }elseif(empty($phone)) {
                  $message = "Phone number should not be empty.";
              }
              elseif(isset($password) || isset($email)) {                     
                  if (strlen($password) &lt; 5 || strlen($password) &gt; 15) {
  
                  $message = "Password must be 5 to 15 characters in length.";
  
                  $registerSuccess = 0;
  
                  }
  
                  //elseif( $password == $confirm_password ) {
  
                  elseif(isset($password) &amp;&amp; $password != $confirm_password) {
  
                      $message = "Password Mismatch";
  
                      $registerSuccess = 0;
  
                  }elseif(!filter_var($email, FILTER_VALIDATE_EMAIL))
                    {
                    $message = "Please enter a valid email.";
                    $registerSuccess = 0;              
                    } 
  
              }elseif(isset($email)) {
                  if(!filter_var($email, FILTER_VALIDATE_EMAIL))
                    {
                    $message = "Please enter a valid email.";
                    $registerSuccess = 0;              
                    } 
              }elseif ( is_wp_error($status) ) {
                  $registerSuccess = 0;
                  $message = "Username or E-mail already exists. Please try another one.";
              }
               else {
                  if($registerSuccess == 1){
                  $from = get_option('admin_email');
                  $headers = 'From: '.$from . "\r\n";
                  $subject = "Registration successful";
                  $msg = "Registration successful.\nYour login details\nUsername: $username\nPassword: $password";
                  wp_mail( $email, $subject, $msg, $headers );
  
                  $registerSuccess = 1;
                  }
              }
  
  
          if($registerSuccess == 1) {
              $login_data = array();
              $login_data['user_login'] = $username;
              $login_data['user_password'] = $password;
              $user_verify = wp_signon( $login_data, false ); 
  
              global $redux_demo; 
              $profile = $redux_demo['profile'];
              wp_redirect( $profile ); exit;
  
          }
  
  
  
      }
  
  }
  
  get_header(); ?&gt;
  
      &lt;div class="ad-title"&gt;
  
                  &lt;h2&gt;&lt;?php the_title(); ?&gt; &lt;/h2&gt;     
      &lt;/div&gt;
  
      &lt;section class="ads-main-page"&gt;
  
          &lt;div class="container"&gt;
              &lt;div class="log-in-logo"&gt;
                  &lt;a class="logo" href="&lt;?php echo home_url(); ?&gt;" title="Home"&gt;
                      &lt;?php global $redux_demo; $logo = $redux_demo['logo']['url']; if (!empty($logo)) { ?&gt;
                          &lt;img src="&lt;?php echo $logo; ?&gt;" alt="Logo" /&gt;
                      &lt;?php } else { ?&gt;
                          &lt;img src="&lt;?php echo get_template_directory_uri(); ?&gt;/images/logo.png" alt="Logo" /&gt;
                      &lt;?php } ?&gt;
                  &lt;/a&gt;                
              &lt;/div&gt;
              &lt;div class="first clearfix log-in"&gt;
  
                  &lt;h2 class="login-title"&gt;REGISTER&lt;/h2&gt; 
                  &lt;?php                   
                      if(get_option('users_can_register')) { //Check whether user registration is enabled by the administrator
                  ?&gt;
  
                  &lt;div id="edit-profile" class="clearfix" &gt;
  
                      &lt;div class="span4"&gt;
                          &lt;form class="form-item login-form" action="" id="primaryPostForm" method="POST" enctype="multipart/form-data"&gt;
  
                                  &lt;?php if($_POST) { 
  
                                      global $redux_demo; 
                                      $login = $redux_demo['login'];
  
                                      echo "&lt;div id='result' style='margin-bottom: 30px;'&gt;&lt;div class='message'&gt;&lt;h4&gt;".$message." ";
  
                                      if($registerSuccess == 1) {
                                          echo "&lt;a href='".$login."'&gt;Login&lt;/a&gt;.";
                                      }
  
                                      echo "&lt;/h4&gt;&lt;/div&gt;&lt;/div&gt;";
  
                                  } ?&gt;
  
                                      &lt;?php if($registerSuccess == 1) { } else { ?&gt;
  
  
  
  
                                          &lt;input id="contactName" placeholder="User Name" type="text" name="username" class="text input-textarea half" value="" maxlength="30" /&gt;
  
                                          &lt;input id="phone" placeholder="Phone Number" type="text" name="phone" class="text input-textarea half" value="" maxlength="30" /&gt;
  
  
                                          &lt;input id="email" placeholder="Email Address" type="text" name="email" class="text input-textarea half" value=""  maxlength="30" /&gt;
  
  
                                          &lt;input id="password" placeholder="Password" type="password" name="pwd" class="text input-textarea half" maxlength="15"  value="" /&gt;
  
  
                                          &lt;input id="password" placeholder="Retype Password" type="password" name="confirm" class="text input-textarea half" maxlength="15" value="" /&gt;
  
  
  
                                      &lt;br/&gt;
  
  
                                          &lt;input type="hidden" name="submit" value="Register" id="submit" /&gt;
                                          &lt;div class="clearfix"&gt;&lt;/div&gt;
                                          &lt;div class="btn-container"&gt; 
                                              &lt;button class="btn form-submit" id="edit-submit" name="op" value="Publish Ad" type="submit"&gt;&lt;?php _e('Submit', 'agrg') ?&gt;&lt;/button&gt;
                                          &lt;/div&gt;
  
  
                                  &lt;?php } ?&gt;
  
                          &lt;/form&gt;
  
  
                          &lt;div class="clearfix"&gt;&lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="span4 last"&gt;
                      &lt;span&gt;Already have an acount ?&lt;/span&gt; &lt;a class="login-a" href=""&gt;Login Now&lt;/a&gt;
  
  
  
  
                          &lt;div class="publish-ad-button login-page"&gt;
  
                              &lt;?php
  
                                  global $redux_demo; 
                                  $login = $redux_demo['login'];
                                  $reset = $redux_demo['reset'];
  
                              ?&gt;
  
  
  
                          &lt;/div&gt;
  
                      &lt;/div&gt;
  
                  &lt;/div&gt;
  
                  &lt;?php }
  
                      else echo "&lt;span class='registration-closed'&gt;Registration is currently disabled. Please try again later.&lt;/span&gt;";
  
                  ?&gt;
  
              &lt;/div&gt;
  
  
  
  
  
          &lt;/div&gt;
  
      &lt;/section&gt;
  
  &lt;?php get_footer(); ?&gt;
  </code></pre>