Output the label of an ACF field

You can output the label of an Advanced Custom Field: ACF field by using the get_field_object() function which stores an array of data about the custom field.

/*
*  Output Label from ACF field
*/

$field_name = "acf_field_name_here";
$field = get_field_object($field_name);

echo '<h3>'. $field['label'] . '</h3>';

2 comments

  • Dorothy

    Can this be done with add_filter function?

  • Aggeliki

    $field_name = ‘my_custom_field’; // Replace with the name of your custom field
    $field_object = get_field_object($field_name);
    if ($field_object) {
    echo $field_object[‘label’];
    }
    ?>

Leave your comment