Customize WordPress User Profile’s Contact Info

WordPress ships with a user-profile feature where each registered user of a WordPress powered site has his or her profile.

By default (not altered by a plugin whatsoever), the user profile consist of the following sections:

  1. Personal Options
  2. Name
  3. Contact Info
  4. About Yourself

In this tutorial, I will be showing us how to customize just the Contact Info section. When I say customize, I meant adding and removing the contact information form fields.
WordPress user contact info.

I never wanted the AIM, Yahoo IM and Jabber / Google Talk field on my blog hence I replaced them with Facebook, Twitter and Google+ fields made possible by WordPress user_contactmethods filter.

The following code adds Facebook, Twitter and Google+ field to the contact methods.


function modify_user_contact_methods( $user_contact ){
	/* Add user contact methods */
	$user_contact['facebook'] = __('Facebook Username'); 
	$user_contact['twitter'] = __('Twitter Username');
	$user_contact['google'] = __('Google+ Profile');

	return $user_contact;
}

add_filter('user_contactmethods', 'modify_user_contact_methods');

To remove an available field – AIM, Yahoo IM, Jabber / Google Talk. Simply unset contact methods.


function modify_user_contact_methods( $user_contact ){
	/* Add user contact methods */
	$user_contact['facebook'] = __('Facebook Username'); 
	$user_contact['twitter'] = __('Twitter Username');
	$user_contact['google'] = __('Google+ Profile');
	
	/* Remove user contact methods */
	unset($user_contact['aim']);
	unset($user_contact['yim']);
	unset($user_contact['jabber']);
	
	return $user_contact;
}

add_filter('user_contactmethods', 'modify_user_contact_methods');

Add contact methods to WordPress user contact info

Note, you can not remove the Email and Website field because $user_contact array only return – aim (AIM), yim (Yahoo IM) and jabber (Jabber / Google Talk).

To implement the modification, add the code to your theme’s functions.php file or use as a plugin.

Happy Coding!!!

Don’t miss out!
Subscribe to My Newsletter
Invalid email address