Support

Account

Home Forums ACF PRO Uncaught ReferenceError: acf is not defined Reply To: Uncaught ReferenceError: acf is not defined

  • It depends on where you’re adding code.

    If you are enqueuing a JS file then you need to set the $deps argument to array('acf-input') and you should also enqueue scripts on the acf/enqueue_scripts hook for any scripts you’re adding for ACF.

    If you are putting code into the page the something like this usually works

    
    (function($){
      // your code here
    }(jQuery)
    

    More information here https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/