This website uses cookies to allow us to see how the site is used. If you continue to use this site, we assume that you are okay with this. If you want to use the sites without cookies, please see our privacy policy.

Remove or add additional information to WordPress user profiles

Sometimes the default WordPress user contact details on user profiles are not needed, this sweet little snippet will remove or add additional information to WordPress user profiles; ideal for memberships sites.

function my_user_contactmethods($user_contactmethods){
   // remove contact items
   // additional contact items
   $user_contactmethods['twitter'] = 'Twitter Username';
   $user_contactmethods['facebook'] = 'Facebook Username';
   return $user_contactmethods;

Once saved the user information can be output using theĀ get_user_meta function, the example below is for logged in users…

if ( is_user_logged_in() ) {
// gets all user data
global $current_user;
// gets user meta by id
$user_info = get_user_meta($current_user->ID);
// outputs specific user meta
echo 'Twitter: ' . $user_info['twitter'][0];
echo 'Facebook: ' . $user_info['facebook'][0];

source: wp.tuts


A geek who likes to code and be nice ^_^

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.