I have user data that's being saved to and read from the database as they are all standard WordPress fields.

example: $user->user_email

frontend and database

And here's the code I have inside the form-edit-account.php:

<p class="form-row form-row-wide">
            <label for="account_uid"><?php _e( 'UID-Nummer', 'woocommerce' ); ?></label>
            <input type="text" class="input-text" name="uidnumber" id="uidnumber" value="<?php echo esc_attr( $user->user_uidnumber ); ?>" />

Here's where I'm at right now:

  • Field does not write into database
  • If value is entered via PHPMyAdmin value is read from database

Essentially: Saving the value doesn't work/is missing.

Help is greatly appreciated!

One thing if I might add:

I added a field in a different section of the website from a tutorial I found online. backend user I know it's kind of wrong to put it under contact_methods, but that's what I found:

function modify_contact_methods($profile_fields) {
    $profile_fields['uidnumber'] = 'UID-Nummer';    return $profile_fields;}
    add_filter('user_contactmethods', 'modify_contact_methods');

add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );

function save_modified_contact_methods( $profile_fields ) {

    /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
    update_usermeta( $profile_fields, 'uidnumber', $_POST['uidnumber'] );

And even though there seems to be something wrong with the add_actions, the code works and saves its data, but I have no idea where to. I can't find it in the wp_usermeta table

I also do not know how to link those two fields together as I can't find the second one's database entry.

To help be more specific about it, I'm uploading both my functions.php and the form-edit-account.php. Hopefully someone can figure out what's wrong.

1 Answer 1


User meta information, like that on the profile page, is stored in the usermeta table in the database. You can add extra fields by hooking into the show_user_profile and edit_user_profile action hooks. Then you can save the information by hooking into the personal_options_update and edit_user_profile_update action hooks with a function that updates the new field in the user meta table, update_user_meta().

First create the fields to be rendered on the profile page

//display extra profile fields
add_action( 'show_user_profile', 'extra_profile_fields' );
add_action( 'edit_user_profile', 'extra_profile_fields' );

function extra_profile_fields( $user )
        <h3>Extra Profile Fields</h3>

        <table class="form-table">
                <th><label for="UID-Nummer"><?php _e( 'UID-Nummer', 'woocommerce' ); ?></label></th>
                <td><input type="text" name="uid-nummer" value="<?php echo esc_attr( get_the_author_meta( 'uid-nummer', $user->ID ) ); ?>" class="regular-text" /></td>

Note the name attribute. It's a good idea to use this same name when saving the field. You can see that we are pulling that field into the value already using get_the_author_meta( 'uid-nummer', $user->ID ).

Save the fields

//save extra profile fields
add_action( 'personal_options_update', 'save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'save_extra_profile_fields' );

function save_extra_profile_fields( $user_id )
    update_user_meta( $user_id,'uid-nummer', sanitize_text_field( $_POST['uid-nummer'] ) );

Using the fields

To display the field ui-nummer you can use either:

//return the author meta
get_the_author_meta( 'ui-nummer', $user->ID );


//echo the author meta
the_author_meta( 'ui-nummer', $user->ID );
  • Updated with a better answer. Hope that helps. Sep 23, 2015 at 23:17
  • It certainly helped, but I just can't seem to get it to actually save the value. No idea why though. Thanks for the help so far.
    – theHubi
    Sep 24, 2015 at 7:41
  • In your functions.php file you have previous functions as well as the functions I gave above. I would remove those and check. Sep 24, 2015 at 14:29
  • Found myself a solution based on your information. I finally found where the data was being saved to and reverse-engineered the input field to communicate with that database field.
    – theHubi
    Sep 24, 2015 at 15:03

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.