Support

Account

Home Forums Front-end Issues Dequeue unnecessary ACF Form Js on frontend

Solving

Dequeue unnecessary ACF Form Js on frontend

  • Hi,
    When using ACF Form as a frontend form, it loads alot of js files (at least 15) that just dont seem necessary for the form I have – its pretty much just text fields. For example, it loads – jquery-ui-datepicker-js , jquery-ui-draggable-js , wp-color-picker-js etc… the list goes on, does anyone know how I could go about stopping all these unecessary fields from loading? Or at the very least dequeue them…

    Many Thanks 🙂

  • The only thing I can point you to is this other topic where it was discussed.

    https://support.advancedcustomfields.com/forums/topic/remove-unused-scripts-styles/

  • Thank you, the acf_update_setting mentioned in that thread was a help,

    With acf_update_setting I was able to get rid of select2, datepicker, timepicker

    Then after much searching and help from Query Monitor, I was able to get the handles and figure out alot of the others need to be dequeued through init hook, so through that I was able to get rid of jq touch punch, iris, wp-color-picker and code-editor.

    Through the init you can also get rid of jq ui core, jq ui mouse, jq ui sortable & jq ui resizable – unfortuneatly due to how they are all dependencies of each other and other scripts are dependencies/dependants of them, they seem to end up causing errors and breaking things with the main acf js object.

    Would be great if there was a way for these not all to be so intertwined however I understand why its like this, it just makes simple text field based forms somewhat pointless in acf_form when compared to other options.

    FYI for anyone in the future: I did have to also deregister & dequeue

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

You must be logged in to reply to this topic.

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.