default-blog

Add or remove contact info fields in wordpress

The WordPress site allows you to edit and change fields in the user profile. This can be accomplished by deleting or adding content for a specific field (YIM, AIM or Jabber). The code below is an example of how one might alter their functions file:

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 can add this function code:

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

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

echo $user_twitter; 
Posted in

Leave a Comment