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 defined some custom fields using Advanced Custom Fields, and I display these fields as keys and values using get_post_meta, e.g.:

<span class="campsite_meta_key">מחיר:</span>
<?php echo get_post_meta($post->ID, 'price', true);?>

<span class="campsite_meta_key">מפה:</span>
<?php echo get_post_meta($post->ID, 'map', true);?>

This involves code duplication, because the Hebrew name of the field (e.g. מפה) is already defined as the custom field label.

Is there a way to programmatically retrieve the a custom field label?

share|improve this question
up vote 3 down vote accepted

See the ACF documentation for get_field_object:

$field_object = get_field_object( 'price', $post->ID );
echo $field_object['label'];
share|improve this answer

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.