Registration Form Fields: (Front-end Registration)

Email (password will generate to email).

Edit Profile: (Front-end Edit Profile)

Zip / postal code,
State(Drop down-Dynamic),
Country(Drop down), 
Newsletter (Check box),
Change password.

The above fields are required for their corresponding pages.

Currently, i am using Theme My Login Plugin for Front-end Login and Registration.

and, Cimy User Extra Fields Plugin for Registration page fields editing. (but, it has no option for adding fields and changing fields in profile page.)

How can we do this by using Custom code editing or Plugin?

If there is any plugin to do this, tell me the Plugin name and Download links.

If it is possible only by Custom code editing, please guide me how to complete this.


This answer is copied from the best post over this topic! I could've just given you the links, but that would get me a comment from the mod to post sample code ;)

For adding the fields:

add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );

function my_show_extra_profile_fields( $user ) { ?>
    <h3>Extra profile information</h3>
    <table class="form-table">
            <th><label for="twitter">Twitter</label></th>
                <input type="text" name="twitter" id="twitter" value="<?php echo esc_attr( get_the_author_meta( 'twitter', $user->ID ) ); ?>" class="regular-text" /><br />
                <span class="description">Please enter your Twitter username.</span>

And for saving the data:

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

function my_save_extra_profile_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) )
        return false;

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

Another helpful link here.

Thank You Justin Tadlock! :D

| improve this answer | |

To add or remove contact fields, add this to your functions.php:

    add_filter('user_contactmethods', 'modify_contact_methods');
    function modify_contact_methods($profile_fields) {
        // Add new fields
    $profile_fields['facebook'] = 'Facebook URL';
    $profile_fields['twitter'] = 'Twitter Username';
    $profile_fields['gplus'] = 'Google+ URL';
    $profile_fields['youtube'] = 'YouTube Channel URL';

    // Remove old fields

    return $profile_fields;

To remove username (and other fields or headers), use jQuery:

function hide_personal_options() { ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) { 
    $('#your-profile > h3').hide(); // removes all headers
    $('#your-profile > table:first').hide(); // remove the entire Personal Options table
    $("#nickname,#display_name,#user_login,#url").parent().parent().remove();  // remove nickname, display name, username, website fields, etc.
| improve this answer | |

And if you want to remove some fields you just unset it like this:

function my_new_contactmethods( $contactmethods ) {
     // Remove Yahoo IM
     unset( $contactmethods['yim'] );

    return $contactmethods;
| 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.