Home Forums ACF PRO Remove injected scripts form front end form Reply To: Remove injected scripts form front end form

  • Hi! Sorry to revive this old thread, but I found this searching for an option to deactivate certain fields on the frontend. Right now, I’m able to dequeue the CSS and JS manually and that’s okay for most of my fields, but I also have some fields that echo some content (namely SVG icons that are hidden with display:none) to facilitate rendering them on the backend when they’re needed.

    That also comes from the fact that I have a few custom fields plugins enabled on the website I’m working on and I’d like to selectively stop them to be “activated” at all on the frontend. All of the fields are always enqueueing their settings and assets regardless if they’re used or not in the form I’m actively displaying on the frontend. In that example, my SVG Icon selector enqueues it’s CSS, JS and echoes its icons even if there’s no SVG Icon selector field added in the form itself.

    Seems like there should be a filter to shortcircuit a field altogether in that case but I can’t find it right now, but that brings me to the other question: aren’t fields lazily initialized? Should they not or is it too complicated since it doesn’t really matter for the backend of things?