I am creating a custom plugin which will be dependent on ACF. I dont really want to include ACF in my plugin, so I have a check on the activation hook to ensure that ACF is installed and active. That part works well.
My next step is that I would like to have my plugin create an ACF field Group, if it doesn’t already exist.
I have done a lot of googling and havent been able to come up with too much for this. Most people seem to be including the ACF plugin in their plugin.
also at the moment, I am using the free version of ACF I plan to get the paid version, but only after I get the development of my plugin done.
First, the free version and the Pro version work differently at the moment, so the method of doing this would be different.
In the pro version there is a function
acf_get_field_groups() that can be used to get a list of field groups.
In the free version there is a filter that can be used,
$field_groups = apply_filters('acf/get_field_groups', array());
You’ll need to look into the ACF code to get more details.
I usually do this on the ACF Pro hook “acf/include_fields” with a high priority so that all other fields groups are already included before I check to see what field groups already exist.
A word of caution. I have had this interfere with other plugins. I’ve had this happen recently with a site and all of the problems were with plugins created by https://yithemes.com/
I have just set up the local json feature and I have the json files in the acf-json folder in my theme root. However, when I manually modify one of the json files (changing the field group title for instance), that change is not reflected in the ACF GUI. Is that somethgin that woudl only work in ACF pro?
I have upgraded to ACF 5 early access using this guide:
You must be logged in to reply to this topic.
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!
📣 “ACF Chat Fridays”— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.