Home Forums General Issues How do you enable the Javascript API?


How do you enable the Javascript API?

  • I feel like I’m missing something obvious…
    I have ACF PRO 5.7.7 installed, but on the front page of my website the console returns:

    VM582:1 Uncaught ReferenceError: acf is not defined
        at <anonymous>:1:1

    Do you have to turn on the Javascript API somewhere?

  • There could be several things going on.

    The first is that the ACF scripts are not included. You should enqueue your scripts on the acf/input/admin_enqueue_scripts hook. You should also use array('acf-input') as the script that your script depends on to make sure that acf is loaded first.

    The second thing that could be happening is that you’re trying to run your script too early. You should not try to interact with ACF until after the document is ready.

    jQuery(document).ready(function($) {
      // your code goes here
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How do you enable the Javascript API?’ is closed to new replies.