Home Forums General Issues Registering a changeable field


Registering a changeable field

  • I’m building a theme where I want to register some fields I know always should be there. I’m totally new to ACF so I’m trying to get my head around best pratices.

    So, lets sat I want to register the field “Attributes”. I can register the field via PHP in my theme and give it the id “my_attributes” and give it some properties and it works perfect.

    This field is now how ever not visible in the admin area under ACF. In this case I would still want to let the users add/remove selectable attributes here, but just not be able to delete nor change the settings for the field since the theme is depending on that it exists.

    Any ideas for best practice for how to achieve this?

  • Fields defined in PHP are not available to edit in the ACF admin. If you want the field to have something that can be modified by the user then you need to create an options page where they can make these changes and then dynamically make these changes to the field using an acf/prepare_field filter.

  • Yea, I solved it by registering a post type called acf_fields and created a taxonomy called acf_attributes. the user can then just name the fields and categorize them, and in my PHP acf field just get all titles/slugs from acf_fileds (from the specific taxonomy) and register them as text fields.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.