Home › Forums › ACF PRO › Exlude fields in acf_form() function › Reply To: Exlude fields in acf_form() function
Yes, this can work.
In this plugin I added my own field setting. Before ACF 5.5 it uses an ACF filter to remove fields from the display. After ACF 5.5 it uses the acf/prepare_field filter to remove fields.
https://github.com/Hube2/acf-user-role-field-setting
There are also some internal functions in ACF that can be used to get field groups for a specific post as well as the fields in those groups. For example
$groups = acf_get_field_groups(array('post_id' => $post_id);
that will give you groups on a page
$fields = acf_get_fields($group['key']);
I think will give you an array of fields in a groups…. but you’ll need to look in the ACF code to make sure how to use these.
However, this can’t be used to remove fields from a group. In order to not show fields by removing them from a group the fields need to be removed when the field group is loaded/created
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!
ποΈ Just one more day until the next session of ACF Chat Fridays! Make sure to register for the latest updates on whatβs coming in ACF 6.1!
— Advanced Custom Fields (@wp_acf) March 30, 2023
π Friday 31st March 3pm UTC
π Register here - https://t.co/3UtvQbDwNm pic.twitter.com/7xtEJakeQN
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.