Remove AIM, Yahoo, and Jabber Fields from the WordPress Profile Page

Remove AIM, Yahoo, and Jabber Fields from the WordPress Profile Page


There are three fields on the WordPress profile page that many people seem to have little use for and so want to remove to cut down on the clutter. They are the fields for AIM, Yahoo IM, and Jabber.

At the same time, many wonder why such popular sites such as Facebook and Twitter don’t have default spots on the profile page.

If that’s your case too, there’s an easy way to both remove the AIM, Yahoo, and Jabber fields and add a Facebook and Twitter field. Simply put the following code in your functions.php file: Appearance > Editor > Theme Functions (functions.php).

 

function edit_contactmethods( $contactmethods ) {
 $contactmethods['facebook'] = 'Facebook'; 
 $contactmethods['twitter'] = 'Twitter';
   unset($contactmethods['yim']);
   unset($contactmethods['aim']);
   unset($contactmethods['jabber']);
 return $contactmethods;
 }
 add_filter('user_contactmethods','edit_contactmethods',10,1);

 

Here’s the result:

As you can see, there’s not much to it, and so if you wanted to edit this code to leave one of the fields in, you could easily do it by removing one of the “unset” lines. For example, if you wanted to leave the Jabber field in, then you would remove the following line from the code:

unset($contactmethods['jabber']);

Likewise, it’s probably also not hard to see how the Twitter and Facebook fields are added. And so if you wanted to add another field for something else, you easily do that to. Just copy the Facebook line of code, for example, and change the labels on it in both spots.

As an example, let’s add a field called “Whatever.” This would be the entire code:

 function edit_contactmethods( $contactmethods ) {
   $contactmethods['facebook'] = 'Facebook'; 
   $contactmethods['twitter'] = 'Twitter';
   $contactmethods['whatever'] = 'Whatever';
   unset($contactmethods['yim']);
   unset($contactmethods['aim']);
   unset($contactmethods['jabber']);
 return $contactmethods;
 }
 add_filter('user_contactmethods','edit_contactmethods',10,1);

And here’s the result with the new “Whatever” field.

Make Your Own Plugin

As mentioned in a previous post, when you have snippets of code like this to be put into your functions file, you can easily turn them into super simple plugins instead. If you’d like to do that, you can read more here.

Photo: vector scissors cutting sticker from BigStock