Support

Account

Home Forums Bug Reports acf/setup_fields trigger ACF 5

Solved

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

  • 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) );
    
Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘acf/setup_fields trigger ACF 5’ is closed to new replies.