Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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.