Support

Account

Home Forums ACF PRO Adding a new location for a field group programmatically

Solved

Adding a new location for a field group programmatically

  • Hi, I have written a plugin which declares a custom fields group, complete with locations, in php. I am now using it on a site that uses an additional Custom Post Type and the options page, and I would like to add this Custom Field group to both. Do I have to add the options page and new CPT to the locations in the plugin, or can I add the new locations – and just the new locations – within my theme? Feels as if this might be something there is a filter for?

  • There is a filter hook acf/get_field_group I do not think that it is documented. It passes your filter the group array. You can use this to modify the location rules.

  • Wonderful, thank you! One of the things I love about ACF is that every time I find myself thinking “I wonder if there is a way to do X”, generally speaking, the answer is yes!

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

The topic ‘Adding a new location for a field group programmatically’ is closed to new replies.

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.