Home › Forums › Bug Reports › acf/setup_fields trigger ACF 5
I am working to convert my Font Awesome field to work with the new ACF version 5
I make heavy use of the acf/setup_fields JS trigger in my plugin. However it looks like ACF 5 does not trigger this action anymore.
Is there a new action that is triggered instead, or is this functionality going to be making its way back in?
Thanks,
Matt Keys
Link to question and answer: http://support.advancedcustomfields.com/forums/topic/acfregister_fields-hook-missing/
There is a reference about other changes: http://www.advancedcustomfields.com/resources/updates/whats-new-version-5/
Hube2,
The JS trigger I am asking about is acf/setup_fields. This is triggered when ACF fields are added to a wordpress post/page. And re-triggered every time new fields are added such as in a repeater.
The post you linked to is talking about issues with a different action (the php action acf/register_fields which used to be used in v4 when adding new field types).
Unless I am missing something, the pages you linked to are not related to my question (although I do appreciate your effort to help). Please correct me if I am wrong and I am missing something.
Thanks,
Matt Keys
Sorry, confused, I read the acf/setup_fields and completely missed the “JS” part.
Have you looked at the new acf-field-type-template setup? https://github.com/elliotcondon/acf-field-type-template. The JS side has changes as well. There is an example JS file that has the if/else statement for setup depending on if ACF4 or ACF5 is running.
Perfect! I had completely missed the JS example in that repo, and it covers exactly the issue I was having with acf/setup_fields. It looks like it was replaced with a ‘ready append’ action.
Thanks Hube2!
If anyone else is having issues here, the specific fix that worked for me is:
// $(document).trigger('acf/setup_fields', $("#"+ formID) );
acf.do_action('ready', $("#"+ formID) );
The topic ‘acf/setup_fields trigger ACF 5’ is closed to new replies.
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.