Home › Forums › General Issues › How do you enable the Javascript API? › Reply To: How do you enable the Javascript API?
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
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.