How to Add extra contact fields in WordPress User Profile | Tutorial Freak – Online Tutorials

How to Add extra contact fields in WordPress User Profile

WordPress allows you to enter your contact information on the user profile. For example, you can enter your aim or jabber screenname. WordPress developers have probably forgotten the fact that most people now use Facebook/Google Plus/Twitter/LinkedIn etc. I will show you a very simple and efficient method to add new contact fields to your user profile in wordpress.

By default, your wordpress user profile looks like the below screenshot.


Very outdated, isn’t it? Well, do not worry. 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;

Your user profile will look something like this after adding the above code:


Remember, there is not limitation to the fields you can add here.

Ok, so now you want to remove those outdated contact options? Jus unset them like it is shown in the below code.

function my_user_contactmethods($user_contactmethods){


  $user_contactmethods['twitter'] = 'Twitter Username';
  $user_contactmethods['facebook'] = 'Facebook Username';

  return $user_contactmethods;


Finally! Now would you like to display your contact info somewhere on your posts/widgets? Its easy as well. Just use the get_user_meta function.

echo get_user_meta(1, 'facebook', true);

This will display the Facebook Username for the user with an ID of 1. The true argument causes the data to be returned as a single value as opposed to an array.

Comments/Suggestions etc can be posted below using the comments box.

Author, Blogger, SEO Expert, Working Professional and a Student! I play so many roles in life and love what i do. I enjoy each moment of my life. Do follow us on Facebook

Sagar – who has written posts on Tutorial Freak – Online Tutorials.

Help keep us alive & kicking, we need coffee 24/7, please donate, thanks!

Leave a Reply

error: Content is protected !!