Calling custom profile fields?

I’ve hidden and created various profile fields using the following code:

function my_user_contactmethods($user_contactmethods) {

// You can get rid of ones you don't want
unset($user_contactmethods['jabber']);
unset($user_contactmethods['yim']);
unset($user_contactmethods['aim']);
unset($user_contactmethods['googleplus']);
unset($user_contactmethods['url']);
unset($user_contactmethods['twitter']);

// And add any news ones. The array key is the meta key name, the text
// is however you want it labelled -- keep the key name the same as you have in gf map.

$user_contactmethods['I work for...'] = __('I work for...');

// etc for each field you want to appear

return $user_contactmethods;

}

add_filter( 'user_contactmethods', 'my_user_contactmethods');

I’m then trying to call the custom field using the following:

Read More
<?php echo get_user_meta($current_user->ID,'I work for...',true);?>

This doesn’t show anything, can someone point me in the right direction?

Related posts

Leave a Reply

1 comment

  1. Try instead

    $user_contactmethods['work'] = __('I work for...');
    

    and

    <?php echo get_user_meta($current_user->ID,'work',true);?>
    

    where the array index is 'work' instead of 'I work for...', i.e. lowercase and without any spaces.