Home › Forums › ACF PRO › Got a question about the file type. › Reply To: Got a question about the file type.
Since you are using a separate JS files you need to get the value into JS so that your script can use it.
You do this by localizing the script. See https://developer.wordpress.org/reference/functions/wp_localize_script/ and look at the user contributed notes.
Basically you
1) register the script
2) localize the script using values in acf fields
3) in your script you get the value from the js object created in step 2 to get the value
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.