I am trying to send an email to administrator with user_register action hook and wp_mail() function when a new user registers. I created some custom registration fields and I want send them via e-mail, but I cannot access them via the get_user_meta() function. I tried to debug this in front-page and using this get_user_meta() function gets me my custom fields, but in functions.php in my custom function, fields are missing and I get only few fields:


add_action( 'user_register', 'so27450945_user_register', 10, 1 );
function so27450945_user_register( $user_id )
    $user = get_user_by( 'id', $user_id );
    $user_meta = get_user_meta( $user_id );

    $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );

    $message  = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
    $message .= sprintf( __( 'Username: %s'), $user->user_login ) . "\r\n\r\n";
    $message .= sprintf( __( 'E-mail: %s'), $user->user_email ) . "\r\n";

    $message .= $user_meta['reg_company'][0];

    @wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message);

Custom fields created with:

// Adding Company information on account registration
function wooc_extra_company_register_fields() {?>
  <p class="form-row">
    <input type="checkbox" class="input-checkbox" name="reg_company" id="reg_company" <?php if ( ! empty( $_POST['reg_company'] ) ) echo "checked"; ?> /><?php _e( 'Registrovat velkoobchod?', 'vinabg' ); ?>
 add_action( 'woocommerce_register_form', 'wooc_extra_company_register_fields' );

And saved like:

function wooc_save_extra_register_fields( $customer_id ) {
      if ( isset( $_POST['reg_company'] ) ) {
             update_user_meta( $customer_id, 'reg_company', $_POST['reg_company'] );
add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' );

Is any chance to get this working? Maybe different functions or hooks? I'd like to just notify administrator when user created new account (using WooCommerce if that matters), and send email with all information about that user (my custom fields).

  • All the metadata is not stored in the database when the user_register hook is triggered as from the documentation
    – Tariq Khan
    Oct 13, 2020 at 12:52

1 Answer 1


When the user_register action is triggered, data from the registration form can be accessed in $_POST.

Get first_name and last_name on user_register hook

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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