Well that’s good. But since the new code you posted does work, I’d start checking things like viewing your browsers source code for the page and verify that your custom script is indeed loading after ACF’s
acf-input.js. Perhaps there is a problem there, even though your
wp_register_script is setup properly.
Also a theme can cause odd behaviors on plugins depending on what it’s trying to do. I’m just in the middle of developing an add-on plugin to ACF and when I popped that code in, it worked great.
I’m sorry I can’t be of more help at this point, but it seems like you DO have the file enqueued properly, just a matter of why the
acf object isn’t able to be accessed. Which is odd, because ACF attaches that object onto
window, so it should be available anywhere.
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!