Sign up ×
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

4 Answers 4

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. – Shakti Singh 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

This is older question but there is this now.. end of form though (only).

WP Version 4.3.0 - File "./wp-admin/user-new.php" - Line 330

 * Fires at the end of the new user form.
 * Passes a contextual string to make both types of new user forms
 * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
 * and 'add-new-user' (single site and network admin).
 * @since 3.7.0
 * @param string $type A contextual string specifying which type of new user form the hook follows.
do_action( 'user_new_form', 'add-existing-user' );

Short example:

add_action('user_new_form', 'addmycustomfield');
function addmycustomfield() {
<table class="form-table">
<th scope="row">My test field:</th>
<td><input type="text" size="32" name="testfield" value="<?php echo get_option('madeup_wp_option'); ?>" /></td>

This will place a field on end of add user form. How to save custom user meta data/etc from registration/add user/profile edit/etc is beyond scope of the question and has been answered many times previously. See comments as well.

share|improve this answer
Would you please expand upon this answer? – s_ha_dum Oct 3 at 16:44
He was looking for action hooks on user add form. This seems to be a new one since first answers were posted above. A code example that expands on this hook is here: – bshea Oct 4 at 2:37
More specifically: this hook allows you to add a field to page he requested. Which was the question.. – bshea Oct 4 at 2:47
I understand but simply pasting code is only helpful to people with experience enough to understand the code. – s_ha_dum Oct 4 at 2:48
Added some code to answer.. also link above in comments is better example. Thanks for input.. – bshea Oct 4 at 3:03

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.