Add/remove contact info fields

User profiles in WordPress have these fields for Contact Info by default: E-mail, Website, AIM, Yahoo IM, Jabber / Google Talk. You can remove those and add new ones as you wish, like in this example code for your functions.php file in your theme:

function new_contactmethods( $contactmethods ) {
   $contactmethods['twitter'] = 'Twitter'; // Add Twitter
   $contactmethods['facebook'] = 'Facebook'; // Add Facebook
   unset($contactmethods['yim']); // Remove YIM
   unset($contactmethods['aim']); // Remove AIM
   unset($contactmethods['jabber']); // Remove Jabber

   return $contactmethods;

To display that publicly, you could:

$user_id = 1;
$key = 'twitter';
$single = true;

$user_twitter = get_user_meta( $user_id, $key, $single); 

echo $user_twitter; 


  1. User Avatar
    Permalink to comment#

    Missed a line! Without defining the filter, the function itself won’t do anything!

  2. User Avatar
    Matt Royce
    Permalink to comment#

    Really like this, and glad I’ve found it! Definitely going to use it on my WordPress installs.

  3. User Avatar
    Permalink to comment#

    Awesome. Didn’t know this, thank you.

  4. User Avatar
    Permalink to comment#

    Removing just works for those three: AIM, YIM, Jabber ;(

  5. User Avatar
    Permalink to comment#

    unset ($ contactmethods [‘url’]) does not remove

Leave a Comment

Posting Code!

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.