Disclosure: We are a professional review site that receives compensation from the companies whose products we review. We test each product thoroughly and give high marks to only the very best. We are independently owned and the opinions expressed here are our own.
One of the things I always thought was a little strange in WordPress was the limited and out dated contact fields for the user profiles. Seriously, who uses AIM and Yahoo anymore. I never used Yahoo Messenger, but I did use AIM and now I almost never use it and I don’t even have it installed on any of my systems. These older services are not as popular as they once were and like most, I connected with most of my instant messenger friends on services such as Facebook and Twitter.
With that in mind, I decided to figure out why WordPress hasn’t updated the user contact fields and find a way to update the code to add and remove fields as needed. I found nothing as to why they haven’t made those changes, but these fields are not that important and they are working on other more important issues (new features and bug fixes) with the code.
Since it looks like WordPress isn’t going to update these fields anytime soon, I decided to figure out how to update these fields myself. I found that it was easy to make these updates and its only a few lines of code added to the functions.php file.
How to Add and Remove Fields to User Contact Fields in WordPress
I decided to remove the AIM, and Yahoo IM and add Twitter, Facebook, and Google+. I ended up keeping Jabber/Google Talk is, because I still use Google Talk and the service is linked through the Google Profile. You can use the service when your email is up. So if someone wants to reach me that way they can. But in the near feature, I believe this field can be removed as well.
The first thing you need to do is load up the editor by going to Admin >>> Appearance>>>Editor>>>Functions.php. Once the Functions.php is loaded, make sure to back up the file before making any changes.
Next, place the below code at the end of the functions.php file. If you place it at the end of the code, make sure to add the code before the ?> if your functions.php file has it. This code will remove the AIM, yahoo IM, and Jabber/Google Talk fields and add Twitter, Facebook, and Google+.
[php]
function extra_contact_info($contactmethods) {
unset($contactmethods[‘aim’]);
unset($contactmethods[‘yim’]);
$contactmethods[‘twitter’] = ‘Twitter’;
$contactmethods[‘facebook’] = ‘Facebook’;
$contactmethods[‘linkedin’] = ‘LinkedIn’;
$contactmethods[‘gprofile’] = ‘Google Plus Profile’;
return $contactmethods;
}
add_filter(‘user_contactmethods’, ‘extra_contact_info’);
[/php]
If you want to keep the default fields, then add this code instead.
[php]
function extra_contact_info($contactmethods) {
$contactmethods[‘twitter’] = ‘Twitter’;
$contactmethods[‘facebook’] = ‘Facebook’;
$contactmethods[‘linkedin’] = ‘LinkedIn’;
$contactmethods[‘gprofile’] = ‘Google Plus Profile’;
return $contactmethods;
}
add_filter(‘user_contactmethods’, ‘extra_contact_info’);
[/php]
Original Source of code came from and article from Web Froze. The code is basically the same, I just changed the order of how the contact fields display.
Nice trick James! I’ll try it at my personal blog this evening. Thanks 🙂
Thank you so much for posting the codes here. Surprisingly, you were able to slither your way out of the outdated contact details such as yahoo and aim. I’m also having some troubles with them at my end.