Support

Account

Home Forums General Issues Need to defer scripts

Solved

Need to defer scripts

  • Hi,

    I have been using a plugin to defer loading of all wp_enqueue_script()

    Unfortunately, it is having a conflict with ACF, and causes it to create 2 posts when my front-end form is submitted, instead of just 1 as it is supposed to. I have submitted another forum thread for this specifically here.

    My questions is, how/where can I defer the Scripts ACF uses?

    Or, what handles do these scripts use?

    Thanks for your time.

  • I imagine that you’re having a problem deferring ACF scripts because they are localized and the plugin is not handling the localization of scripts properly, but that’s just a guess.

    The scripts in ACF also depend on jQuery and several others so you would need to not defer these as well.

    If you’re using ACF5 you can look in the plugin file /advanced-custom-fields-pro/acf.php on line 369 and you find a function named register_assets(). This is where all the scripts are registered.

  • I found some additional ones in /advanced-custom-fields-pro/pro/acf-pro.php on line 132.

    Here is the list of script handles used in ACF Pro

    
    select2
    acf-input
    acf-field-group
    select2-l10n
    acf-pro-input
    acf-pro-field-group
    

    Here is a list of the script handles that are listed as scripts the above scripts depend on

    
    jquery
    jquery-ui-core
    jquery-ui-sortable
    jquery-ui-resizable
    jquery-ui-datepicker
    wp-color-picker
    select2
    select2-l10n
    
  • This is what I needed. Thanks for taking the time to respond!

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

The topic ‘Need to defer scripts’ is closed to new replies.