I am currently trying to display both the value and the label for Advanced Custom Fields (ACF) by using their documentation here: https://www.advancedcustomfields.com/resources/select/
Currently only the label will display.
In the ACF plugin tool for choices it says:
Enter each choice on a new line.
For more control, you may specify both a value and label like this:
red : Red
So I entered the following:
free : Free License
To display the value and label I entered my field name:
<?php
$field = get_field_object('license_type');
$value = $field['value'];
$label = $field['choices'][ $value ];
echo 'Value: ' . $value . '<br>' . 'Label: ' . $label;
?>
This only displays the value like so:
Value: Free Licence
Label:
Which seems wrong I believe that should actually be the label.
What I should or I want to display is:
Value: free
Label: Free License
It seems pretty straight forward but I must be doing something wrong.