Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created extra field that user can edit on their 'Your Profile' page. The extra field also available on WordPress register page. What I want to ask is, how to add the field to User > Add new page ? So, when admin creates a user, admin also input the user's extra field

share|improve this question

3 Answers 3

up vote 1 down vote accepted

With no hooks on that page (User > Add new page) other then user_new_form_tag its not possible to add new fields unless you hack the core file wp-admin/user-new.php .

You could try adding that extra field by adding in in JQuery and processing it when the $_post['action'] == 'adduser' but that wont be very good practice.

share|improve this answer
I want to avoid hacking the core, so maybe I will choose the jQuery solution. It is okay if it's not very good practice, As long as it works :D, thanks for the solution Bainternet –  Permana May 31 '11 at 6:45
Glad i could help. –  Bainternet May 31 '11 at 6:53
Personally, I would say the jQuery approach is better practice than hacking core. Once you have modified core, upgrading becomes a chore. –  Joe Hoyle May 31 '11 at 10:44
@Bainternet: Where do some one put that $_post['action'] == 'adduser' and How can get the last inserted wordpress user's id to update the user extra field in custom table. You should expend your answer. –  Framework Oct 6 '12 at 10:08

I was able to do this through a rather fragile hack. It uses the output buffer to insert the new field. Thankfully there's a nice hook to save the field.

// FRAGILE!  This rewrites code directly in the buffer, upgrading WP may break this
function wpse18772_add_fields( $buffer ) {
  $input_html = '<input type="text" name="your-new-field" id="your-new-field">';

  // will insert a new field after "role"
  $buffer = preg_replace( '~<label\s+for="role">(.*?)</tr>~ims', '<label for="role">$1</tr><tr class="form-field"><th>My New Field</th><td>' . $input_html . '</td></tr>', $buffer );

  return $buffer;

function wpse18772_buffer_start() { ob_start("wpse18772_add_fields");  }
function wpse18772_buffer_end() { ob_end_flush(); }
add_action('admin_head', 'wpse18772_buffer_start', 10, 1);
add_action('admin_footer', 'wpse18772_buffer_end', 10, 1);

function wpse18772_save_fields($user_id) {
  if($_POST['action'] != "adduser" && $_POST['action'] != "createuser") return;

  if(!empty($_POST['your-new-field'])) {
    // save field to meta, or do whatever you want to here
add_action('user_register', 'wpse18772_save_fields');
share|improve this answer

See this answer. There are no hooks, but you can do it with jQuery. Simply add your html markup with jQuery and it will be done.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.