Support

Account

Home Forums General Issues Field Types from Field Groups Reply To: Field Types from Field Groups

  • Hi John,

    Well, after a couple of hours wondering why your perfectly logical code wasn’t working, it turns out that my client is still using ACF4 and I just assumed (yup, I’m an ass) it was v5.

    So, anyway, until they’re happy to upgrade to v5 here’s my working v4 code which is very similar to yours – the main difference being the apply_filters on line 3:

    $groupID = 92;
    $fields = array();
    $fields = apply_filters('acf/field_group/get_fields', $fields, $groupID);
      if($fields) {
        foreach( $fields as $field) {
          if ($field['type'] == 'email') {
            echo "<li>" . $field['label'] . "</li>";
          }
        }
      }

    Thanks for your help, it definitely made things a lot easier.