Display ACF Select and Checkbox Field Labels

Get the human-readable label of a select or checkbox field choice rather than the stored value.

php field-types
|

Get the human-readable label of a select or checkbox field choice rather than the stored value.

ACF select and checkbox fields store the value, not the label. To display the label, use get_field_object():

<?php
$field  = get_field_object( 'colour' );
$value  = $field['value'];
$label  = $field['choices'][ $value ] ?? '';

echo esc_html( $label ); // e.g. "Bright Red" instead of "bright_red"

For a checkbox or multi-select field (which returns an array of values):

<?php
$field   = get_field_object( 'features' );
$values  = $field['value'];

if ( $values ) {
    echo '<ul>';
    foreach ( $values as $value ) {
        $label = $field['choices'][ $value ] ?? $value;
        echo '<li>' . esc_html( $label ) . '</li>';
    }
    echo '</ul>';
}

If you only need the value and your field’s return format is set to Label in the field settings, get_field() will return the label directly:

<?php
// When return format is "Label" or "Both (Array)".
$label = get_field( 'colour' ); // Returns "Bright Red"

// When return format is "Both (Array)".
$field = get_field( 'colour' ); // Returns [ 'value' => 'bright_red', 'label' => 'Bright Red' ]

Related Snippets

Stay Updated

Get ACF tips and new extensions in your inbox

No spam. Unsubscribe anytime.