Home › Forums › ACF PRO › Exlude fields in acf_form() function › Reply To: Exlude fields in acf_form() function
Thanks for the feedback… I understand the idea, but what I’m mainly looking for is to get rid of the manual definition of field id’s since I feel it’s quite error prone. A typo is easily made. I’d like to make that generic/variable.
I was thinking in the line of something like below. The functions might be wrong, but I think the idea is clear
function get_field_ids( $field_group_id ) {
$all_fields = get_field_object();
$field_keys = array();
foreach ( $all_fields as $field ) {
$field_keys[] = $field['key'];
}
return $field_keys;
}
Then you can remove only the fields you don’t need from this array.
It’s easily forgotten to add a new field ID, when you add fields to the field group.
But I understand that it’s not possible (yet).
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.