Home / functions.php / Add contact methods to profile, Twitter, Facebook, Flickr
  • How to Add contact methods to profile, Twitter, Facebook, Flickr

    add-contact-methods-to-profile-twitter-facebook-flickr

    Adding this to the functions.php of your wordpress theme will add Twitter, Facebook, Linkedin and Flickr contact info fields to users profiles. This will also remove aim, yim and jabber fields from user profile pages.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    function add_remove_contactmethods( $contactmethods ) {
    	$contactmethods['twitter'] = 'Twitter';
    	$contactmethods['facebook'] = 'Facebook';
    	$contactmethods['linkedin'] = 'Linked In';
    	$contactmethods['flickr'] = 'Flickr';
            // this will remove existing contact fields
    	unset($contactmethods['aim']);
    	unset($contactmethods['yim']);
    	unset($contactmethods['jabber']);
    	return $contactmethods;
    }
    add_filter('user_contactmethods','add_remove_contactmethods',10,1);
    

    ( WordPress codex functions, hooks, in this snippet. )

    user_contactmethods, add_filter,
  • wow great .. thanks

  • Jan

    Interesting… but how to display this information on the site in the profiles of your members?!

    • Place this into your template to display the information.

             get_the_author_meta($curauth->ID);
             echo $curauth->facebook;

  • izoel servo

    hi kevin, well .. i’m hooked already with this genius website, a part that i’m not genius at the moment , my simple basic question , okay, we already created alot of fields ..and where the data storage goes at database, already checked table wp_users and..there’s nothing on it .. please advise ..thanks

    • @google-842df667d8aa359c307fc2f356644c63:disqus  you don’t need to do anything but add this snippet to the functions.php of your wordpress theme.
      You will then need a little bit of code to display it within your theme.

      For the author add,

             get_the_author_meta($curauth->ID);
             echo $curauth->facebook;

  • Danni

    add_filter(‘user_contactmethods’,’add_remove_contactmethods’,10,1);Is causing issues.

    • Hi Danni what problems are you encountering?

  • Watermelonkid

    Easy enough to add these things–anyone figured out a way to REMOVE ones that you don’t want–namely: Website. Neither of the following works:

    unset($contactmethods[‘Website’]);
    unset($contactmethods[‘url’]);