plugins – Display ACF values for all fields in a group


I am trying to display all the values from a particular group created with ACF.

My current code looks like:

    $fields = acf_get_fields(92);

    if ($fields) {
        foreach($fields as $field) {
            $value = get_field( $field['name'] );
            if (!empty($value)) {
                echo '<p>'.$field['name'].'</p>';

This is pretty close, this is getting my group and displaying the field name as long as it’s not empty, which is as close as I could get. Each field in the group is a standard text field. Instead of displaying the name of each field, I’d like to display the value – which is the value of the actual text input (what people type in the field through the WP admin panel).

I tried field['text'], field['value'], field['input'], and field[] but none of those seemed to work and I can’t find a list of things that get returned. Anyone have any ideas?


Josh Rodgers 2 months 2022-12-06T12:28:47-05:00 0 Answers 0 views 0

Leave an answer