Home › Forums › Feature Requests › Options page input used as field label for other custom fields › Reply To: Options page input used as field label for other custom fields
Put it in your functions.php file
// this adds a filter for the field that you want
// to dynamically set the label for
// it can be used in several ways
// https://www.advancedcustomfields.com/resources/acfload_field/
add_filter('acf/load_field/key=field_0123456789abc', 'set_my_field_label');
// this is the function that is called for the filter
function set_my_field_label($field) {
// get the value from the field you want to use for the label
$label = get_field('field_label_option', 'option');
if ($label) {
// if the option is set then change the field label
// almost any field argument can be changed dyamically
$field['label'] = $label;
}
return $field;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.