I have 1 additional field I want to display on the user profile page (mainly admin users will use this)

I have done it but it is showing up at the very bottom of the page, I want it to sit in the area where the first name, last name and nickname are etc.

I tried different actions like personal_options_update as I believe that should position the box differently but then the field just vanishes.

add_action('show_user_profile', 'custom_user_profile_fields');

add_action('edit_user_profile', 'custom_user_profile_fields');

function custom_user_profile_fields( $user ) {
    <table class="form-table">
                <label for="my_field"><?php _e( 'My field' ); ?></label>
                <input type="text" name="my_field" id="my_field" value="<?php echo esc_attr( get_the_author_meta( 'my_field', $user->ID ) ); ?>" class="regular-text" />

add_action( 'personal_options_update', 'update_extra_profile_fields' );

add_action( 'edit_user_profile_update', 'update_extra_profile_fields' );

function update_extra_profile_fields( $user_id ) {
    if ( current_user_can( 'edit_user', $user_id ) )
        update_user_meta( $user_id, 'my_field', $_POST['my_field'] );

WordPress doesn't support such field placement in user profile. If you absolutely need to have your meta field after Nickname, you can use javascript to move form field from one place to another. Look at this example, but change it to move entire <tr>.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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