WordPress tip: Add extra contact methods to user profiles

Nothing complicated: Just paste the following code into your function.php file. Edit lines 4 and 5 according to your needs.

add_filter('user_contactmethods', 'my_user_contactmethods');

function my_user_contactmethods($user_contactmethods){
  $user_contactmethods['twitter'] = 'Twitter Username';
  $user_contactmethods['facebook'] = 'Facebook Username';

  return $user_contactmethods;
}

Hungry for code snippets? I just opened a snippet library on CatsWhoCode, which include lots of WordPress snippets. Have a look, and don’t hesitate to submit yours!

Thanks to TutsPlus for the cool tip!

Leave a Reply

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