Not working with ACF 5.9
daltonrooney opened this issue ยท 4 comments
I just updated to 5.9 and my customizer fields don't work any longer. Any chance you're still developing this plugin?
I'm having the same issue, and I think I found a solution. The problem that I was having is that the acf-customizer javascript files weren't being enqueued within Customizer, causing it not to run the Ajax request that handles rendering of field groups. Within the code file /include/ACFCustomizer/Compat/ACF/Customize.php
on line 110, it adds on to the acf/enqueue_scripts
action after being called from customize_controls_enqueue_scripts
then calls the acf_enqueue_scripts
function which in theory would run acf/enqueue_scripts
.
Unfortunately, I think that ACF 5.9 is running acf_enqueue_scripts
on Customizer pages now before this and it's ignoring the second call. I've amended my local code to simply check if the acf/enqueue_scripts
action has already been called by using did_action
. If it has, then just call the \ACFCustomizer\Core\Customize::enqueue_assets
function directly. That does the trick for me!
if (did_action('acf/enqueue_scripts') <= 0) {
add_action('acf/enqueue_scripts',array($this,'enqueue_assets'));
acf_enqueue_scripts();
acf_enqueue_uploader();
} else {
$this->enqueue_assets();
}
I'm not sure if acf_enqueue_uploader
should just be run every time, though.
I just updated to 5.9 and my customizer fields don't work any longer. Any chance you're still developing this plugin?
๐
I have the same question too.
Thanks @dcooperdalrymple!
Glad it worked out! I've been using this adjusted code for a few months now without any problems. :)