I was trying to display a form on a webpage using acf_from and wanted to display all fields in a Field Group, except for 2 of them. acf_from attributes allow for whitelisting a field_group and specific fields to be displayed, but there’s no way to blacklist them. So I made a function to do it for me and thought I’d share here –
You send this function a field group ID as the first parameter and it sends back an array of field keys that are in that group.
You can optionally send the second parameter (as an array of field keys) – these will be excluded from the returned array.
After you have the keys, you implement your form using the whitelist fields attribute. Usage example below –