Snippet: Add Custom User Profile Fields

Although wordpress user profile has pretty much every thing inside it. But in case if you want to add your own field to user profile pages.

Add following code to “functions.php”

Usage

the_author_meta('facebook', $current_author->ID);

Snippet

add_filter('user_contactmethods','extra_userfields',10,1);
function extra_userfields( $extra_contact ) {
    $extra_contact['twitter']       = 'Twitter URL';
    $extra_contact['facebook']       = 'Facebook URL';
    return $extra_contact;
}

Update:
This snippet is limited to add only text fields. If you want to use other form fields, check out our latest snippet that shows how to add any type of html form field to user’s profile.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>