WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

// 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:

<?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?

share|improve this question
Use Advanced Custom Fields plugin – lenden Jul 9 '14 at 20:01
up vote 1 down vote accepted

Try instead

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


<?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.

share|improve this answer
I've just tried that, the info is getting inserted into the custom field but it still won't show on the front end. Is there another way to call it? – Rob Mar 4 '13 at 11:16
It works on my vanilla wp install, I just tested it. I checked the profile.php page for the current user, and inserted some value and saved it. Then added the code on single.php to test. – birgire Mar 4 '13 at 11:21
does this work for you: <?php echo "current userid:". $current_user->ID;?> – birgire Mar 4 '13 at 11:23
It's in the header.php file, so outside of the loop, that's probably why it's not working. – Rob Mar 4 '13 at 11:24
ok add global $current_user; before the code. – birgire Mar 4 '13 at 11:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.