Support

Account

Home Forums Feature Requests How to Display multiple fields in just one php line? Reply To: How to Display multiple fields in just one php line?

  • There isn’t any way to do what you’re looking for. There is get_field() that gets one value from one field https://www.advancedcustomfields.com/resources/get_field/ and there is get_field() that gets all the values for all the fields on a page https://www.advancedcustomfields.com/resources/get_fields/

    If you want to get a list of specific fields then you’d need to call get_field() for each.

    
    $field_names = array('field-name-1','field-name-2','field-name-3');
    $fields = array();
    foreach ($field_names as $field_name) {
     $fields[$field_name] = get_field($field_name);
    }